Skip to content

Cryptography parsed the CRL file with an empty Key Identifier. #13051

Open
@onepeople158

Description

@onepeople158

Version: 45.0.3

Hello Developer, I successfully parsed a CRL file with an empty Key Identifier using Cryptography.When I used GnuTLS to parse this CRL file, it returned an error: error: gnutls_x509_ext_import_authority_key_id: ASN1 parser: Error in DER parsing. Is this considered an error?

Test Case:

crl_empty_key.zip

Code:

from cryptography.x509 import load_pem_x509_crl, load_der_x509_crl
from cryptography.x509 import ExtensionNotFound
import sys

def load_crl(file_path):
    with open(file_path, "rb") as f:
        crl_data = f.read()
    try:
        crl = load_pem_x509_crl(crl_data)
    except ValueError:
        crl = load_der_x509_crl(crl_data)
    return crl

def print_crl_issuer(file_path):
    crl=load_crl(file_path)
    aki_extension = None
    try:
        for ext in crl.extensions:
             if ext.oid == x509.oid.ExtensionOID.AUTHORITY_KEY_IDENTIFIER:
                    aki=ext.value
                    print(aki)
    except Exception as e:
        print(f"Error parsing CRL: {e}")

file_path = 'filename'
print_crl_issuer(file_path)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Stalewaiting-on-reporterIssue is waiting on a reply from the reporter. It will be automatically cloesd if there is no reply.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions