summaryrefslogtreecommitdiff
path: root/src/cryptography
diff options
context:
space:
mode:
authorPaul Kehrer <paul.l.kehrer@gmail.com>2021-05-31 13:40:16 -0500
committerGitHub <noreply@github.com>2021-05-31 14:40:16 -0400
commit52ccb8eb1efbd820c7fd29b6196c70d40f443315 (patch)
tree956d82705c41b8fbad2a5058d265fb679fa1821c /src/cryptography
parent8397d8a181915e79b319da176d4892296154fedd (diff)
downloadcryptography-52ccb8eb1efbd820c7fd29b6196c70d40f443315.tar.gz
oxidize basic constraints (#6080)
Diffstat (limited to 'src/cryptography')
-rw-r--r--src/cryptography/hazmat/backends/openssl/backend.py1
-rw-r--r--src/cryptography/hazmat/backends/openssl/decode_asn1.py17
2 files changed, 1 insertions, 17 deletions
diff --git a/src/cryptography/hazmat/backends/openssl/backend.py b/src/cryptography/hazmat/backends/openssl/backend.py
index 2efc386f0..83a4cca69 100644
--- a/src/cryptography/hazmat/backends/openssl/backend.py
+++ b/src/cryptography/hazmat/backends/openssl/backend.py
@@ -409,6 +409,7 @@ class Backend(BackendInterface):
ext_count=self._lib.sk_X509_EXTENSION_num,
get_ext=self._lib.sk_X509_EXTENSION_value,
handlers=ext_handlers,
+ rust_callback=rust_x509.parse_x509_extension,
)
self._revoked_cert_extension_parser = _X509ExtensionParser(
self,
diff --git a/src/cryptography/hazmat/backends/openssl/decode_asn1.py b/src/cryptography/hazmat/backends/openssl/decode_asn1.py
index 4b45fbce5..7be2b2789 100644
--- a/src/cryptography/hazmat/backends/openssl/decode_asn1.py
+++ b/src/cryptography/hazmat/backends/openssl/decode_asn1.py
@@ -296,22 +296,6 @@ def _decode_user_notice(backend, un):
return x509.UserNotice(notice_reference, explicit_text)
-def _decode_basic_constraints(backend, bc_st):
- basic_constraints = backend._ffi.cast("BASIC_CONSTRAINTS *", bc_st)
- basic_constraints = backend._ffi.gc(
- basic_constraints, backend._lib.BASIC_CONSTRAINTS_free
- )
- # The byte representation of an ASN.1 boolean true is \xff. OpenSSL
- # chooses to just map this to its ordinal value, so true is 255 and
- # false is 0.
- ca = basic_constraints.ca == 255
- path_length = _asn1_integer_to_int_or_none(
- backend, basic_constraints.pathlen
- )
-
- return x509.BasicConstraints(ca, path_length)
-
-
def _decode_subject_key_identifier(backend, asn1_string):
asn1_string = backend._ffi.cast("ASN1_OCTET_STRING *", asn1_string)
asn1_string = backend._ffi.gc(
@@ -779,7 +763,6 @@ def _parse_asn1_generalized_time(backend, generalized_time):
_EXTENSION_HANDLERS_BASE = {
- ExtensionOID.BASIC_CONSTRAINTS: _decode_basic_constraints,
ExtensionOID.SUBJECT_KEY_IDENTIFIER: _decode_subject_key_identifier,
ExtensionOID.KEY_USAGE: _decode_key_usage,
ExtensionOID.SUBJECT_ALTERNATIVE_NAME: _decode_subject_alt_name,