英文:
Extract version attribute from the CRL
问题
在提取如图所示的版本2时遇到问题
openssl crl -inform DER -text -noout -in CRL
from cryptography.hazmat.backends import default_backend
def extract_crl_version(crl_file_path):
with open(crl_file_path, "rb") as file:
crl_data = file.read()
crl = x509.load_der_x509_crl(crl_data, default_backend())
crl_version = crl.version
return crl_version
crl_file_path = "path/to/crl.crl"
crl_version = extract_crl_version(crl_file_path)
print("CRL版本:", crl_version)
这对我来说不起作用
错误: crl_version = crl.version AttributeError: 'CertificateRevocationList' 对象没有 'version' 属性
英文:
Facing issues while extracting the version 2 as shown in the image
openssl crl -inform DER -text -noout -in CRL
from cryptography.hazmat.backends import default_backend
def extract_crl_version(crl_file_path):
with open(crl_file_path, "rb") as file:
crl_data = file.read()
crl = x509.load_der_x509_crl(crl_data, default_backend())
crl_version = crl.version
return crl_version
crl_file_path = "path/to/crl.crl"
crl_version = extract_crl_version(crl_file_path)
print("CRL Version:", crl_version)
This is not working for me
ERROR: crl_version = crl.version
AttributeError: '_CertificateRevocationList' object has no attribute 'version'
答案1
得分: 1
在此URL中没有属性版本:
https://cryptography.io/en/3.4/x509/reference.html#x-509-crl-certificate-revocation-list-object
尝试打印crl的长度和
for r in crl:
print(r.serial_number)
英文:
no attribute version. in this url:
https://cryptography.io/en/3.4/x509/reference.html#x-509-crl-certificate-revocation-list-object
try print len(crl) and
for r in crl:
print(r.serial_number)
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论