Commit 7664ca18 authored by Vincent Pelletier's avatar Vincent Pelletier

caucase.utils: Follow cryptography unwillingness to parse long OIDs

parent 0d663926
0.9.?? (????-??-??)
===================
* Fix support for recent (at least >= 40.0.2) cryptography versions
0.9.14 (2022-11-07) 0.9.14 (2022-11-07)
=================== ===================
* Janitorial: make updated code checkers happier. * Janitorial: make updated code checkers happier.
......
...@@ -101,9 +101,21 @@ CAUCASE_POLICY_INFORMATION_AUTO_SIGNED = x509.PolicyInformation( ...@@ -101,9 +101,21 @@ CAUCASE_POLICY_INFORMATION_AUTO_SIGNED = x509.PolicyInformation(
CAUCASE_LEGACY_OID_TOP = '2.25.285541874270823339875695650038637483517' CAUCASE_LEGACY_OID_TOP = '2.25.285541874270823339875695650038637483517'
CAUCASE_LEGACY_OID_AUTO_SIGNED = CAUCASE_LEGACY_OID_TOP + '.0' CAUCASE_LEGACY_OID_AUTO_SIGNED = CAUCASE_LEGACY_OID_TOP + '.0'
CAUCASE_LEGACY_OID_RESERVED = CAUCASE_LEGACY_OID_TOP + '.999' CAUCASE_LEGACY_OID_RESERVED = CAUCASE_LEGACY_OID_TOP + '.999'
_CAUCASE_LEGACY_OID_AUTO_SIGNED = x509.oid.ObjectIdentifier( try:
_CAUCASE_LEGACY_OID_AUTO_SIGNED = x509.oid.ObjectIdentifier(
CAUCASE_LEGACY_OID_AUTO_SIGNED, CAUCASE_LEGACY_OID_AUTO_SIGNED,
) )
except ValueError: # pragma: no-cover
# cryptography started raising when instanciating long OIDs somewhere up to
# 40.0.2 .
_CAUCASE_AUTO_SIGNED_OID_SET = (
_CAUCASE_OID_AUTO_SIGNED,
)
else: # pragma: no-cover
_CAUCASE_AUTO_SIGNED_OID_SET = (
_CAUCASE_OID_AUTO_SIGNED,
_CAUCASE_LEGACY_OID_AUTO_SIGNED,
)
def isCertificateAutoSigned(crt): def isCertificateAutoSigned(crt):
""" """
...@@ -123,10 +135,7 @@ def isCertificateAutoSigned(crt): ...@@ -123,10 +135,7 @@ def isCertificateAutoSigned(crt):
pass pass
else: else:
for policy_information in extension.value: for policy_information in extension.value:
if policy_information.policy_identifier in ( if policy_information.policy_identifier in _CAUCASE_AUTO_SIGNED_OID_SET:
_CAUCASE_OID_AUTO_SIGNED,
_CAUCASE_LEGACY_OID_AUTO_SIGNED, # BBB
):
return True return True
return False return False
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment