I want the 'issued to' information from certificate in python. I try to use the SSL and SSLSocket library but did not happen.
相关问题
- how to define constructor for Python's new Nam
- streaming md5sum of contents of a large remote tar
- How to get the background from multiple images by
- Evil ctypes hack in python
- Correctly parse PDF paragraphs with Python
If you use
requests
, a simple code is here:The result is as follow:
Updated answer
If you can establish a connection to the remote server you can use the
ssl
standard library module:Original answer
Use pyOpenSSL.
You can also access additional components, e.g. organisation (
subject.O
/issuer.O
), organisational unit (subject.OU
/issuer.OU
).Your certificate file might be in another format, so you could try
crypto.FILETYPE_ASN1
instead ofcrypto.FILETYPE_PEM
.