Modifying variable to fit epextions. (#679)
This commit is contained in:
parent
bc94353850
commit
c24810b876
|
@ -114,7 +114,7 @@ class KeyUsageExtension(Field):
|
||||||
'useDataEncipherment': value.data_encipherment,
|
'useDataEncipherment': value.data_encipherment,
|
||||||
'useKeyAgreement': value.key_agreement,
|
'useKeyAgreement': value.key_agreement,
|
||||||
'useKeyCertSign': value.key_cert_sign,
|
'useKeyCertSign': value.key_cert_sign,
|
||||||
'useCrlSign': value.crl_sign,
|
'useCRLSign': value.crl_sign,
|
||||||
'useEncipherOnly': value._encipher_only,
|
'useEncipherOnly': value._encipher_only,
|
||||||
'useDecipherOnly': value._decipher_only
|
'useDecipherOnly': value._decipher_only
|
||||||
}
|
}
|
||||||
|
@ -135,19 +135,26 @@ class KeyUsageExtension(Field):
|
||||||
for k, v in value.items():
|
for k, v in value.items():
|
||||||
if k == 'useDigitalSignature':
|
if k == 'useDigitalSignature':
|
||||||
keyusages['digital_signature'] = v
|
keyusages['digital_signature'] = v
|
||||||
|
|
||||||
elif k == 'useNonRepudiation':
|
elif k == 'useNonRepudiation':
|
||||||
keyusages['content_commitment'] = v
|
keyusages['content_commitment'] = v
|
||||||
|
|
||||||
elif k == 'useKeyEncipherment':
|
elif k == 'useKeyEncipherment':
|
||||||
keyusages['key_encipherment'] = v
|
keyusages['key_encipherment'] = v
|
||||||
|
|
||||||
elif k == 'useDataEncipherment':
|
elif k == 'useDataEncipherment':
|
||||||
keyusages['data_encipherment'] = v
|
keyusages['data_encipherment'] = v
|
||||||
|
|
||||||
elif k == 'useKeyCertSign':
|
elif k == 'useKeyCertSign':
|
||||||
keyusages['key_cert_sign'] = v
|
keyusages['key_cert_sign'] = v
|
||||||
elif k == 'useCrlSign':
|
|
||||||
|
elif k == 'useCRLSign':
|
||||||
keyusages['crl_sign'] = v
|
keyusages['crl_sign'] = v
|
||||||
|
|
||||||
elif k == 'useEncipherOnly' and v:
|
elif k == 'useEncipherOnly' and v:
|
||||||
keyusages['encipher_only'] = True
|
keyusages['encipher_only'] = True
|
||||||
keyusages['key_agreement'] = True
|
keyusages['key_agreement'] = True
|
||||||
|
|
||||||
elif k == 'useDecipherOnly' and v:
|
elif k == 'useDecipherOnly' and v:
|
||||||
keyusages['decipher_only'] = True
|
keyusages['decipher_only'] = True
|
||||||
keyusages['key_agreement'] = True
|
keyusages['key_agreement'] = True
|
||||||
|
@ -208,20 +215,28 @@ class ExtendedKeyUsageExtension(Field):
|
||||||
for k, v in value.items():
|
for k, v in value.items():
|
||||||
if k == 'useClientAuthentication' and v:
|
if k == 'useClientAuthentication' and v:
|
||||||
usage_oids.append(x509.oid.ExtendedKeyUsageOID.CLIENT_AUTH)
|
usage_oids.append(x509.oid.ExtendedKeyUsageOID.CLIENT_AUTH)
|
||||||
|
|
||||||
if k == 'useServerAuthentication' and v:
|
if k == 'useServerAuthentication' and v:
|
||||||
usage_oids.append(x509.oid.ExtendedKeyUsageOID.SERVER_AUTH)
|
usage_oids.append(x509.oid.ExtendedKeyUsageOID.SERVER_AUTH)
|
||||||
|
|
||||||
if k == 'useCodeSigning' and v:
|
if k == 'useCodeSigning' and v:
|
||||||
usage_oids.append(x509.oid.ExtendedKeyUsageOID.CODE_SIGNING)
|
usage_oids.append(x509.oid.ExtendedKeyUsageOID.CODE_SIGNING)
|
||||||
|
|
||||||
if k == 'useEmailProtection' and v:
|
if k == 'useEmailProtection' and v:
|
||||||
usage_oids.append(x509.oid.ExtendedKeyUsageOID.EMAIL_PROTECTION)
|
usage_oids.append(x509.oid.ExtendedKeyUsageOID.EMAIL_PROTECTION)
|
||||||
|
|
||||||
if k == 'useTimestamping' and v:
|
if k == 'useTimestamping' and v:
|
||||||
usage_oids.append(x509.oid.ExtendedKeyUsageOID.TIME_STAMPING)
|
usage_oids.append(x509.oid.ExtendedKeyUsageOID.TIME_STAMPING)
|
||||||
|
|
||||||
if k == 'useOCSPSigning' and v:
|
if k == 'useOCSPSigning' and v:
|
||||||
usage_oids.append(x509.oid.ExtendedKeyUsageOID.OCSP_SIGNING)
|
usage_oids.append(x509.oid.ExtendedKeyUsageOID.OCSP_SIGNING)
|
||||||
|
|
||||||
if k == 'useEapOverLAN' and v:
|
if k == 'useEapOverLAN' and v:
|
||||||
usage_oids.append(x509.oid.ObjectIdentifier("1.3.6.1.5.5.7.3.14"))
|
usage_oids.append(x509.oid.ObjectIdentifier("1.3.6.1.5.5.7.3.14"))
|
||||||
|
|
||||||
if k == 'useEapOverPPP' and v:
|
if k == 'useEapOverPPP' and v:
|
||||||
usage_oids.append(x509.oid.ObjectIdentifier("1.3.6.1.5.5.7.3.13"))
|
usage_oids.append(x509.oid.ObjectIdentifier("1.3.6.1.5.5.7.3.13"))
|
||||||
|
|
||||||
if k == 'useSmartCardLogon' and v:
|
if k == 'useSmartCardLogon' and v:
|
||||||
usage_oids.append(x509.oid.ObjectIdentifier("1.3.6.1.4.1.311.20.2.2"))
|
usage_oids.append(x509.oid.ObjectIdentifier("1.3.6.1.4.1.311.20.2.2"))
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue