diff --git a/sort_certificate.py b/sort_certificate.py index 0adf4ae..a40bb2f 100755 --- a/sort_certificate.py +++ b/sort_certificate.py @@ -30,9 +30,9 @@ ASN1TIME_FMT = str('%Y%m%d%H%M%SZ'.encode('utf8')) OPENSSLTIME_FMT = '%b %e %T %Y GMT' -class OnlyRSAKeyException(Exception): +class UnsupportedPkEncryption(Exception): ''' - When we encounter other than RSA crypto material + When we encounter unsupported encryption algorithms ''' pass @@ -84,7 +84,7 @@ def get_cert_pubkey(cert): def get_priv_pubkey(priv): ''' - Get the pubkey of a RSA private key + Get the pubkey of a private key ''' priv_crypto = priv.to_cryptography_key() @@ -196,7 +196,7 @@ def order_x509(x509_objects, root_issuers): def load_root_issuers(): ''' - Return the list of CA roots (RSA only) + Return the list of CA roots ''' root_issuers = None @@ -223,8 +223,8 @@ def load_root_issuers(): root_cert.get_issuer(), root_cert.has_expired(), get_cert_pubkey(root_cert)) - except OnlyRSAKeyException as onlyrsa_exception: - logging.debug(onlyrsa_exception) + except UnsupportedPkEncryption as unsupported_crypto_exception: + logging.debug(unsupported_crypto_exception) continue root_issuers = {str(root_cert.get_subject()): root_cert @@ -236,7 +236,7 @@ def handle_args(): ''' Handle tool arguments ''' - parser = ArgumentParser(description='Reorder X509/RSA data for' + parser = ArgumentParser(description='Reorder X509/Private key data for' ' hosting use') loggrp = parser.add_mutually_exclusive_group() @@ -369,7 +369,7 @@ def main(): logging.info('OK: Public key of provided certificate' ' and RSA private key match') elif len(pk_objects) > 1: - raise CertificateComponentException('More than one RSA private key' + raise CertificateComponentException('More than one private key' ' found in input.' ' Aborting') elif pk_objects: