-
Notifications
You must be signed in to change notification settings - Fork 28
Open
Description
Hello!
I'm trying to decrypt data and it's working on any emulator, but real devices do not work (tested on API 24 and 30).
Any clues? Below is my code snippet
` public String decryptData(String transportKey, String cipher){
lazySodium = new LazySodiumAndroid(new SodiumAndroid());
byte[] cipherBytes = Base64.decode(cipher, Base64.DEFAULT);
byte[] transportKeyBytes = Base64.decode(transportKey, Base64.DEFAULT);
byte[] nonceBytes = Arrays.copyOfRange(cipherBytes, 0, AEAD.AES256GCM_NPUBBYTES);
byte[] cipherTextBytes = Arrays.copyOfRange(cipherBytes, AEAD.AES256GCM_NPUBBYTES, cipherBytes.length);
long[] outMessageLength = new long[1];
byte[] outMessage = new byte[1000];
lazySodium.cryptoAeadAES256GCMDecrypt(outMessage, outMessageLength, null, cipherTextBytes, cipherTextBytes.length, null, 0, nonceBytes, transportKeyBytes);
outMessage = Arrays.copyOfRange(outMessage, 0, (int)outMessageLength[0]);
return new String(outMessage, StandardCharsets.UTF_8);
}`
Metadata
Metadata
Assignees
Labels
No labels