【发布时间】:2016-05-19 13:05:23
【问题描述】:
我想将 AES 密钥存储在 pre-M 设备上的 AndroidKeyStore 中
我尝试使用KeyGenerator生成的密钥
KeyGenerator keyGen = KeyGenerator.getInstance(KeyProperties.KEY_ALGORITHM_AES);
keyGen.init(256);
SecretKey secretKey = keyGen.generateKey();
但我无法从 KeyStore 访问该密钥,后来我尝试使用 KeyPairGenerator
KeyPairGenerator kpg = KeyPairGenerator.getInstance(
KeyProperties.KEY_ALGORITHM_AES, "AndroidKeyStore");
kpg.initialize(new KeyPairGeneratorSpec.Builder(this)
.setAlias("alias")
.build());
KeyPair kp = kpg.genKeyPair();
但是
java.security.NoSuchAlgorithmException:未找到 KeyPairGenerator AES 实现
【问题讨论】:
-
嗨.. 我找到了一些关于如何使用与 pre-M 兼容的 AES 的教程:proandroiddev.com/…
标签: android encryption keystore android-keystore