java - 我可以在 Android 上使用 Bouncy CaSTLe Keystore.UBER 吗?

标签 java android security bouncycastle keystore

根据 Bouncy CaSTLe 文档,KeyStore 有三种实现方式:

The Bouncy Castle package has three implementation of a keystore.

The first "BKS" is a keystore that will work with the keytool in the same fashion as the Sun "JKS" keystore. The keystore is resistent to tampering but not inspection.

> The second, Keystore.BouncyCastle, or Keystore.UBER will only work with the keytool if the password is provided on the command line, as the entire keystore is encrypted with a PBE based on SHA1 and Twofish. PBEWithSHAAndTwofish-CBC. This makes the entire keystore resistant to tampering and inspection, and forces verification. The Sun JDK provided keytool will attempt to load a keystore even if no password is given, this is impossible for this version. (One might wonder about going to all this trouble and then having the password on the command line! New keytool anyone?).

In the first case, the keys are encrypted with 3-Key-TripleDES.

The third is a PKCS12 compatible keystore. PKCS12 provides a slightly different situation from the regular key store, the keystore password is currently the only password used for storing keys. Otherwise it supports all the functionality required for it to be used with the keytool. In some situations other libraries always expect to be dealing with Sun certificates, if this is the case use PKCS12-DEF, and the certificates produced by the key store will be made using the default provider. In the default case PKCS12 uses 3DES for key protection and 40 bit RC2 for protecting the certificates. It is also possible to use 3DES for both by using PKCS12-3DES-3DES or PKCS12-DEF-3DES-3DES as the KeyStore type.

我在 Internet 上找不到任何关于此的有趣信息,似乎没有人使用它。

是否可以在 Android 上使用 Keystore.BouncyCaSTLe 或 Keystore.UBER?如何获取实例? KeyStore.getInstance("UBER","BC"); ?它适用于所有 android 版本吗?

最佳答案

是的,可以使用,通过以下方式获取实例:

KeyStore.getInstance("UBER", "SC");

在普通的 java 代码中,这里应该是“BC”(BouncyCaSTLe)提供者,但是在 Android 上使用的是 SpongyCaSTLe,所以我们需要把“SC”放在这里。

关于java - 我可以在 Android 上使用 Bouncy CaSTLe Keystore.UBER 吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25847463/

相关文章:

java - 如何限制由 quartz-scheduler 触发的查询

java - RecyclerView 不调用 getItemCount

android - 在 Bundle 中存储 SparseBooleanArray 的最佳方式?

symfony - 在生产中使用 symfony/dotenv 包

node.js:使用用户输入作为命令行参数是否安全?

java - 如何将单维索引转换为多维数组中的相应索引?

java - 如何浏览 2 个列表并进行检查

android - 在 Android 中使用没有 ksoap2 的 SOAP 网络服务

java - 为什么会崩溃?以及如何调试?

javascript - 加密通行证的重新散列在 Node.js 中使用加密返回不同的结果