是否有用于解析pkcs7的python软件包? [英] Is there any python package for parsing pkcs7?

查看:139
本文介绍了是否有用于解析pkcs7的python软件包?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 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).

from


问题:用于解析pkcs7的python包?

Question: python package for parsing pkcs7?

您可以使用openssl将PKCS#7转换为PEM,使用

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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆