Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
M2Crypto SMIME 对象具有从 PEM 格式的 PKCS#7 文件加载自身的方法:
smime_object = SMIME.load_pkcs7('file.pem')
我没有看到任何从 DER 格式的 PKCS#7 文件加载的方法。如何才能做到这一点?
SMIME.load_pkcs7_der()M2Crypto 0.26.0 中添加了一个功能。
SMIME.load_pkcs7_der()
为了以 DER 格式加载 PKCS#7,您应该使用中间 BIO,例如:
file = open('file.der') bio = BIO.File(file) smime_object = SMIME.PKCS7(m2.pkcs7_read_bio_der(bio._ptr()))