Skip to content

Commit

Permalink
updated script
Browse files Browse the repository at this point in the history
  • Loading branch information
bh3000 committed Feb 14, 2025
1 parent 17c8c4d commit f744451
Showing 1 changed file with 16 additions and 10 deletions.
26 changes: 16 additions & 10 deletions credentials/generate_revocation_set.py
Original file line number Diff line number Diff line change
Expand Up @@ -270,12 +270,14 @@ def get_certificate_authority_details(crl_signer_certificate: x509.Certificate,
logging.debug("Using CRL Signer certificate for details")

certificate_authority_name = cert_for_details.subject
certificate_akid = get_skid(cert_for_details)

logging.debug(f"Certificate Authority Name: {certificate_authority_name}")
logging.debug(f"Certificate AKID: {certificate_akid}")
try:
certificate_akid = get_skid(cert_for_details)
logging.debug(f"Certificate Authority Name: {certificate_authority_name}")
logging.debug(f"Certificate AKID: {certificate_akid}")

return certificate_authority_name, certificate_akid
return certificate_authority_name, certificate_akid
except ExtensionNotFound:
logging.warning("Certificate SKID not found in authoarity certificate.")

def get_b64_name(name: x509.name.Name) -> str:
'''
Expand Down Expand Up @@ -360,7 +362,7 @@ def get_paa_cert(self, initial_cert: x509.Certificate) -> Optional[x509.Certific
try:
akid = get_akid(initial_cert)
except ExtensionNotFound:
logging.error('Certificate AKID not found.')
logging.warning('Certificate AKID not found.')
return
paa_certificate = None
while not paa_certificate:
Expand All @@ -379,7 +381,7 @@ def get_paa_cert(self, initial_cert: x509.Certificate) -> Optional[x509.Certific
try:
akid = get_akid(issuer_certificate)
except ExtensionNotFound:
logging.error('Issuer Certificate AKID not found.')
logging.warning('Issuer Certificate AKID not found.')
logging.debug(f"akid: {akid}")
if paa_certificate is None:
logging.warning("PAA Certificate not found, continue...")
Expand Down Expand Up @@ -578,9 +580,13 @@ def __init__(self, crls: [], dcl_certificates: [], revocation_points_response_fi


def get_lookup_key(self, certificate: x509.Certificate) -> str:
base64_name = get_b64_name(certificate.subject)
skid_hex_formatted = self.get_formatted_hex_skid(get_skid(certificate))
return base64_name + skid_hex_formatted
base64_name = get_b64_name(certificate.subject)
try:
skid = get_skid(certificate)
skid_hex_formatted = self.get_formatted_hex_skid(skid)
return base64_name + skid_hex_formatted
except ExtensionNotFound:
logging.warning("CertificateSKID not found, continue...")


def get_crls(self, unread_crls: []) -> list[x509.CertificateRevocationList]:
Expand Down

0 comments on commit f744451

Please sign in to comment.