简体   繁体   English

尝试使用OpenSSL在python中读取CRL pem文件

[英]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. 我有一些CRL文件,需要阅读发行人,上次更新和下一次更新的信息。 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. 我正在使用Python 2.7和pyOpenSSL 0.15。 How can I read issuer and other data in CRL? 如何读取CRL中的发行人和其他数据?

First: I think you need to update you pyOpenSSL library. 首先:我认为您需要更新pyOpenSSL库。 The latest (17.0 from the 20.04.2017) has the following functions: 最新版本(2017年4月20日的版本为17.0)具有以下功能:

get_issuer()

In order to get the CRL's issuer. 为了获得CRL的发行人。

And

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

In order to export the CRL as a string. 为了将CRL导出为字符串。

Parameters: 参数:

  • cert (X509) – The certificate used to sign the CRL. cert(X509)–用于签署CRL的证书。

  • key (PKey) – The key used to sign the CRL. 密钥(PKey)–用于签署CRL的密钥。

  • type (int) – The export format, either FILETYPE_PEM, FILETYPE_ASN1, or FILETYPE_TEXT. type(int)–导出格式为FILETYPE_PEM,FILETYPE_ASN1或FILETYPE_TEXT。
  • days (int) – The number of days until the next update of this CRL. days(int)–直到下次更新此CRL的天数。
  • digest (bytes) – The name of the message digest to use (eg b"sha2566"). 摘要(字节)–要使用的消息摘要的名称(例如b“ sha2566”)。

Source: The PyOpenSSL library website : 资料来源:PyOpenSSL库网站:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Python OpenSSL-验证CRL文件 - Python OpenSSL - Verifying a CRL File 如何从 python SSL 库中的 PEM 字符串加载 CRL 以进行 SSL 验证? - How to load CRL for SSL verification from PEM string in python SSL library? OpenSSL 加密错误:[(&#39;PEM 例程&#39;,&#39;PEM_read_bio&#39;,&#39;无起始行&#39;)] - OpenSSL crypto error: [('PEM routines', 'PEM_read_bio', 'no start line')] Python Websockets 创建 pem 文件 - Python Websockets create pem file JupyterHub openssl自签名证书“​​错误:错误:0906D06C:PEM例程:PEM_read_bio:无起始行” - JupyterHub openssl self signed cert “Error: error:0906D06C:PEM routines:PEM_read_bio:no start line” 尝试将文件中的信息读入Python中的两个列表 - Trying to read information in a file into two lists in Python 试图从 python 中的另一个文件中读取数据 - Trying to read a data from another file in python 尝试在 python 上读取被阻止的 xls 文件时出错 - Error trying to read blockede xls file on python 试图读取文本文件 python 中的每个数字 - trying to read every number in a text file python 使用PFX证书的Python请求将不起作用! -OpenSSL.SSL.Error:[(&#39;PEM例程&#39;]-是否需要PFX到PEM的转换? - Python Requests using PFX certificate wont work ! - OpenSSL.SSL.Error: [('PEM routines'] - PFX to PEM conversion necessary?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM