Эх сурвалжийг харах

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 жил өмнө
parent
commit
5a49c5a464

+ 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);