Open
Description
In the issuer_or_subject_length
function there is a check for the presence of one of the parameters where the check should really be that at least one parameter was passed with a value:
def issuer_or_subject_length(country, state_prov, city, org, org_unit, common):
"""Returns total length of provided certificate information."""
tot_len = 0
if country:
tot_len += 11 + len(country)
if state_prov:
tot_len += 11 + len(state_prov)
if city:
tot_len += 11 + len(city)
if org:
tot_len += 11 + len(org)
if org_unit:
tot_len += 11 + len(org_unit)
if common:
tot_len += 11 + len(common)
else:
raise TypeError("Provided length must be > 0")
return tot_len
The else
on the bottom should be changed to if not tot_len
or the equivalent.