列出 Android 上所有已安装的证书
我正在编写一个应用程序,其中列出了安装的所有证书 设备。但是我发现证书有两个地方 存储:
System/etc/security/cacerts.bks:该文件包含所有 预装证书。我可以使用读取这个文件 Frameworks/ 中定义的密钥库类 base/keystore/java/android/security.
data/misc/keystore:安装证书的另一种方法(例如通过 certinstaller 应用程序)安装第三方证书并制作 它在此目录中的条目。
但我不知道如何读取序列号等证书信息, 此文件中的 IssuerDN 等。
I am writing an app which lists all the certificates installed on
the device. But I found that there are two places where certificates
are stored:
System/etc/security/cacerts.bks: This file contains list of all
pre-installed certificate. I am able to read this file using
Keystore class defined in frameworks/
base/keystore/java/android/security.data/misc/keystore: Another way to install certificates (e.g. through
certinstaller app) installs third party certificate and makes
its entry in this directory.
But I am not getting how to read certificate info like SerialNumber,
IssuerDN etc. from this file.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
我使用下面的代码片段来列出
I use the below code snippet to list
对于我和我运行 10.7.5 的 Mac 以及附带的 JavaVM + keytool,Shashwat Shriparv 描述的过程略有不同:
For me and my Mac running 10.7.5 and the JavaVM + keytool shipped with it the process described by Shashwat Shriparv is slightly different:
当我查看 /etc/security/cacerts 时,我看到以 ASCII 测试形式存储的所有这些证书的列表。您要求的参数、序列号和发行人信息均以文本形式存储。只需将其作为文本文件打开并读入您要查找的字符串即可。
As I look through /etc/security/cacerts, I see a list of all of these certificates stored as ASCII test. The parameters you've asked for, SerialNumber and Issuer info are stored as text. Just open it as a text file and read in the strings you are looking for.
这里是一个开源Android应用程序,可以帮助您查看X509证书信息-
Here is an open source android app which could help you to see X509 Certificate information-