是否有用于解析pkcs7的python软件包? [英] Is there any python package for parsing pkcs7?
问题描述
我正在使用 androguard 从Android .APK文件中提取功能,现在我需要提取签名文件(通常为CERT.RSA)中的序列号(*).我找到了 asn1crypto ,但是我不太了解如何在pkcs7中使用它.那么是否有适合此目的的python软件包?
I'm extracting features from Android .APK files with androguard and right now I need to extract the serial number(*) from its signature file (usually CERT.RSA). I've found asn1crypto, but I don't quite understand, how to use it with pkcs7. So is there any python package suitable for this purpose?
(*):
推荐答案
注释:我将pkcs7作为内存对象,而不是文件
Comment: I have pkcs7 as a memory object, not a file
PyOpenSSL
不能从文件中读取!
OpenSSL.crypto.load_pkcs7_data(类型,缓冲区)
OpenSSL.crypto.load_pkcs7_data(type, buffer)
从以类型type编码的字符串缓冲区中加载pkcs7数据.
类型类型必须为FILETYPE_PEM或FILETYPE_ASN1).
Load pkcs7 data from the string buffer encoded with the type type.
The type type must either FILETYPE_PEM or FILETYPE_ASN1).
问题:用于解析pkcs7的python包?
Question: python package for parsing pkcs7?
You can convert PKCS#7 to PEM using openssl, PEM is readable using PyOpenSSL
openssl pkcs7 -print_certs -in sample.p7b -out sample.cer
阅读相关的SO解答: pyOpenSSL的PKCS7
这篇关于是否有用于解析pkcs7的python软件包?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!