Android digital signature using keystore certificate
目标
我已经开发了用于桌面的JAVA应用程序,用于通过访问密钥库(Windows-MY)使用存储在PC中的x509证书对PDF和XML文件进行数字签名。我正在尝试通过访问android keystore在Android设备(电话/平板电脑)中开发相同的功能。
问题
X509证书可以存储在USB令牌中,也可以直接从SD卡的"设置">"用户凭据"中安装。我认为对于USB令牌,制造商应支持android os,否则它将不会显示在密钥库中。但是我在用户凭据中安装的证书又如何呢?我不确定这两种情况下都使用哪个密钥库。
我尝试了以下所有密钥库,但没有运气。
1 2 3 4 | KeyStore.getInstance(KeyStore.getDefaultType()); KeyStore.getInstance("AndroidCAStore"); // returns only trusted ca certificates not the certificates in User Credentials KeyStore.getInstance("AndroidKeyStore"); KeyStore.getInstance("BKS"); |
任何帮助将不胜感激!
谢谢
设备上安装的用户凭据可通过Android KeyChain获得,而不是通过Android KeyStore
获得
https://developer.android.com/reference/android/security/KeyChain.html
The KeyChain class provides access to private keys and their corresponding certificate chains in credential storage.
用法与Windows-MY略有不同,因为您需要要求用户请求别名。使用