diff --git a/sort_certificate.py b/sort_certificate.py index 8ad4de3..0adf4ae 100755 --- a/sort_certificate.py +++ b/sort_certificate.py @@ -289,6 +289,10 @@ def handle_args(): help='Omit key from output') outputgrp.set_defaults(print_key=True) + parser.add_argument('-i', '--informational', + action='store_true', + help='Show some information about the PEM blocks') + parser.add_argument('x509files', metavar='x509 file', nargs='*', @@ -417,12 +421,13 @@ def main(): logging.info('Subject: %s', x509_subject) logging.info('Issuer: %s', x509_issuer) - logging.info(CERTINFO_TEMPLATE.format( - subject=x509_subject, - issuer=x509_issuer, - notbefore=x509_not_before.strftime(OPENSSLTIME_FMT), - notafter=x509_not_after.strftime(OPENSSLTIME_FMT), - sha1fingerprint=x509_object.digest('sha1').decode())) + if args.informational: + print(CERTINFO_TEMPLATE.format( + subject=x509_subject, + issuer=x509_issuer, + notbefore=x509_not_before.strftime(OPENSSLTIME_FMT), + notafter=x509_not_after.strftime(OPENSSLTIME_FMT), + sha1fingerprint=x509_object.digest('sha1').decode())) if not args.check: print(crypto.dump_certificate(crypto.FILETYPE_PEM,