简体   繁体   中英

Trying to read CRL pem file in python with OpenSSL

I have CRL files which I need to read issuer, last update and next update information. However I am only able to read revoked as given below.

crl = crypto.load_crl(crypto.FILETYPE_PEM, pem)

revoked_list = crl.get_revoked()

I am using Python 2.7 and pyOpenSSL 0.15. How can I read issuer and other data in CRL?

First: I think you need to update you pyOpenSSL library. The latest (17.0 from the 20.04.2017) has the following functions:

get_issuer()

In order to get the CRL's issuer.

And

export(cert, key, type=1, days=100, digest=<object object>)

In order to export the CRL as a string.

Parameters:

  • cert (X509) – The certificate used to sign the CRL.

  • key (PKey) – The key used to sign the CRL.

  • type (int) – The export format, either FILETYPE_PEM, FILETYPE_ASN1, or FILETYPE_TEXT.
  • days (int) – The number of days until the next update of this CRL.
  • digest (bytes) – The name of the message digest to use (eg b"sha2566").

Source: The PyOpenSSL library website :

http://www.pyopenssl.org/en/stable/api/crypto.html#OpenSSL.crypto.CRL

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM