Skip to content Skip to sidebar Skip to footer

Android - Javax.crypto.aeadbadtagexception

I'm currently getting an AEADBadTagException when trying to decrypt a file I have encrypted. I have searched pretty much everywhere on stackoverflow and unable to find a solution,

Solution 1:

Turns out readBytes() uses a default buffer size, and only returns a byte buffer that is the length of that. So it was not actually returning me the whole file in bytes, just up to the length of the buffer.

I have switched to using a CipherOutputStream, be sure to include flush() after writing your contents to the tag will be included!

Solution 2:

i got the same error,finnaly i found the answer. when i encrypt(data1) and encrypt(data2),i want get the data1 by decrypt(data1.encryptStr),i got this problem(Caused by: android.security.KeyStoreException: Signature/MAC verification failed). so ,if you upload 2 files,you couldn`t get this first file by decrypt it

Post a Comment for "Android - Javax.crypto.aeadbadtagexception"