Show some information about the PEM blocks with -i

This commit is contained in:
Ruben van Staveren 2020-09-09 15:39:45 +02:00
parent fe5286b8e5
commit 66f45feea5
Failed to extract signature

View File

@ -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,