小编Zla*_*tko的帖子

使用Android指纹时出现问题:解密时需要IV.使用IvParameterSpec或AlgorithmParameters来提供它

我正在关注Google提供的ConfirmCredential Android示例,但它只显示了如何加密数据.当我尝试解密它时,我得到例外:

java.security.InvalidKeyException: IV required when decrypting. Use IvParameterSpec or AlgorithmParameters to provide it.
Run Code Online (Sandbox Code Playgroud)

我使用以下代码:

String transforation = KeyProperties.KEY_ALGORITHM_AES + "/" + KeyProperties.BLOCK_MODE_CBC + "/" + KeyProperties.ENCRYPTION_PADDING_PKCS7;

KeyStore keyStore = KeyStore.getInstance("AndroidKeyStore");
keyStore.load(null);
SecretKey secretKey = (SecretKey) keyStore.getKey(KEY_NAME, null);

// encrypt
Cipher cipher = Cipher.getInstance(transforation);
cipher.init(Cipher.ENCRYPT_MODE, secretKey);
String encriptedPassword = cipher.doFinal("Some Password".getBytes("UTF-8"));

// decrypt
cipher = Cipher.getInstance(transforation);
cipher.init(Cipher.DECRYPT_MODE, secretKey);
String password = new String(cipher.doFinal(encriptedPassword), "UTF-8"));
Run Code Online (Sandbox Code Playgroud)

在行中抛出异常:

cipher.init(Cipher.DECRYPT_MODE, secretKey);
Run Code Online (Sandbox Code Playgroud)

在这种情况下,任何关于解密的正确方法的想法?

encryption android

15
推荐指数
1
解决办法
6563
查看次数

更新到Android Studio 1.4后出现字体大小问题

今天早上我更新到Android Studio 1.4,我的编辑器的字体大小比以前大得多.我使用Darcula方案.当我检查Darcula方案的配置时,它使用的是12种大小的Monospaced字体.

其他人有同样的问题,还是仅仅是我?

android android-studio

5
推荐指数
1
解决办法
524
查看次数

更改自定义Android佩戴表面上的电池图标的位置

我正在创建一个自定义表盘,我想改变它上面的电池图标的位置.默认情况下,它位于左上角,我希望它位于任务栏上的其他位置.

有谁知道怎么做?

android clock wear-os

4
推荐指数
1
解决办法
2859
查看次数

标签 统计

android ×3

android-studio ×1

clock ×1

encryption ×1

wear-os ×1