mirror of
https://github.com/adulau/crl-monitor.git
synced 2024-11-21 17:47:09 +00:00
Verbose option added (-v) to show issuer CN and subject CN
This commit is contained in:
parent
b1bdae9f89
commit
b1643dab64
1 changed files with 4 additions and 0 deletions
|
@ -14,6 +14,7 @@ import OpenSSL
|
|||
import argparse
|
||||
|
||||
argParser = argparse.ArgumentParser(description='Extract certificate to PEM format from an ssldump output')
|
||||
argParser.add_argument('-v', default=False, action='store_true', help='Verbose output')
|
||||
argParser.add_argument('-r', default='-', help='Read from a file, default is stdin')
|
||||
args = argParser.parse_args()
|
||||
|
||||
|
@ -39,6 +40,9 @@ for l in fileinput.input(args.r):
|
|||
dercert = binascii.unhexlify(a)
|
||||
x509 = OpenSSL.crypto.load_certificate(OpenSSL.crypto.FILETYPE_ASN1, dercert)
|
||||
fp = x509.digest('sha1').replace(':','').lower()
|
||||
if args.v:
|
||||
print "Issuer: " + x509.get_issuer().CN
|
||||
print "CN: " + x509.get_subject().CN
|
||||
print OpenSSL.crypto.dump_certificate(OpenSSL.crypto.FILETYPE_PEM, x509)
|
||||
certstring = ""
|
||||
y = ""
|
||||
|
|
Loading…
Reference in a new issue