瀏覽代碼

Encryption: Get IV directly from the cipher object when encrypting the private key.

In Android O and newer (at least) javax.crypto.spec.IvParameterSpec is unsupported. Get the IV directly from the cipher object instead.
eho 7 年之前
父節點
當前提交
5a49c5a464
共有 1 個文件被更改,包括 1 次插入1 次删除
  1. 1 1
      src/main/java/com/owncloud/android/utils/EncryptionUtils.java

+ 1 - 1
src/main/java/com/owncloud/android/utils/EncryptionUtils.java

@@ -514,7 +514,7 @@ public class EncryptionUtils {
         byte[] bytes = encodeStringToBase64Bytes(privateKey);
         byte[] encrypted = cipher.doFinal(bytes);
 
-        byte[] iv = cipher.getParameters().getParameterSpec(IvParameterSpec.class).getIV();
+        byte[] iv = cipher.getIV();
         String encodedIV = encodeBytesToBase64String(iv);
         String encodedSalt = encodeBytesToBase64String(salt);
         String encodedEncryptedBytes = encodeBytesToBase64String(encrypted);