Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

getBytes throws AEADBadTagException #26

Open
xraw opened this issue Feb 12, 2018 · 0 comments
Open

getBytes throws AEADBadTagException #26

xraw opened this issue Feb 12, 2018 · 0 comments

Comments

@xraw
Copy link

xraw commented Feb 12, 2018

While encryption / decryption works on 5.x and 6.x series, on a S7 with 7.x I get this exception while decoding with getBytes. Data amount less than 32K works without issues, but whenever I try with larger data I get this (see below). Then I tried to write chunked byte buffers (split a large byte buffer into multiple 32K buffers) but the problem remains the same.

02-12 18:35:49.786 9791-10394/xx.myapplication W/System.err: javax.crypto.AEADBadTagException
02-12 18:35:49.787 9791-10394/xx.myapplication W/System.err: at android.security.keystore.AndroidKeyStoreCipherSpiBase.engineDoFinal(AndroidKeyStoreCipherSpiBase.java:517)
02-12 18:35:49.787 9791-10394/xx.myapplication W/System.err: at javax.crypto.Cipher.doFinal(Cipher.java:2056)
02-12 18:35:49.787 9791-10394/xx.myapplication W/System.err: at devliving.online.securedpreferencestore.EncryptionManager.decryptAES(EncryptionManager.java:422)
02-12 18:35:49.787 9791-10394/xx.myapplication W/System.err: at devliving.online.securedpreferencestore.EncryptionManager.decrypt(EncryptionManager.java:266)
02-12 18:35:49.787 9791-10394/xx.myapplication W/System.err: at devliving.online.securedpreferencestore.EncryptionManager.tryDecrypt(EncryptionManager.java:211)
02-12 18:35:49.788 9791-10394/xx.myapplication W/System.err: at devliving.online.securedpreferencestore.EncryptionManager.decrypt(EncryptionManager.java:310)
02-12 18:35:49.788 9791-10394/xx.myapplication W/System.err: at devliving.online.securedpreferencestore.SecuredPreferenceStore.getString(SecuredPreferenceStore.java:116)
02-12 18:35:49.788 9791-10394/xx.myapplication W/System.err: at devliving.online.securedpreferencestore.SecuredPreferenceStore.getBytes(SecuredPreferenceStore.java:184)
02-12 18:35:49.788 9791-10394/xx.myapplication W/System.err: at xx.myapplication.utils.WebService$4.then(WebService.java:206)
02-12 18:35:49.788 9791-10394/xx.myapplication W/System.err: at xx.myapplication.utils.WebService$4.then(WebService.java:197)
02-12 18:35:49.788 9791-10394/xx.myapplication W/System.err: at bolts.Task$15.run(Task.java:917)
02-12 18:35:49.788 9791-10394/xx.myapplication W/System.err: at bolts.BoltsExecutors$ImmediateExecutor.execute(BoltsExecutors.java:105)
02-12 18:35:49.788 9791-10394/xx.myapplication W/System.err: at bolts.Task.completeAfterTask(Task.java:908)
02-12 18:35:49.788 9791-10394/xx.myapplication W/System.err: at bolts.Task.continueWithTask(Task.java:715)
02-12 18:35:49.788 9791-10394/xx.myapplication W/System.err: at bolts.Task.continueWithTask(Task.java:726)
02-12 18:35:49.788 9791-10394/xx.myapplication W/System.err: at bolts.Task$13.then(Task.java:818)
02-12 18:35:49.788 9791-10394/xx.myapplication W/System.err: at bolts.Task$13.then(Task.java:806)
02-12 18:35:49.788 9791-10394/xx.myapplication W/System.err: at bolts.Task$15.run(Task.java:917)
02-12 18:35:49.788 9791-10394/xx.myapplication W/System.err: at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
02-12 18:35:49.788 9791-10394/xx.myapplication W/System.err: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
02-12 18:35:49.788 9791-10394/xx.myapplication W/System.err: at java.lang.Thread.run(Thread.java:762)
02-12 18:35:49.789 9791-10394/xx.myapplication W/System.err: Caused by: android.security.KeyStoreException: Signature/MAC verification failed
02-12 18:35:49.789 9791-10394/xx.myapplication W/System.err: at android.security.KeyStore.getKeyStoreException(KeyStore.java:1097)
02-12 18:35:49.789 9791-10394/xx.myapplication W/System.err: at android.security.keystore.KeyStoreCryptoOperationChunkedStreamer.doFinal(KeyStoreCryptoOperationChunkedStreamer.java:224)
02-12 18:35:49.789 9791-10394/xx.myapplication W/System.err: at android.security.keystore.AndroidKeyStoreAuthenticatedAESCipherSpi$BufferAllOutputUntilDoFinalStreamer.doFinal(AndroidKeyStoreAuthenticatedAESCipherSpi.java:373)
02-12 18:35:49.789 9791-10394/xx.myapplication W/System.err: at android.security.keystore.AndroidKeyStoreCipherSpiBase.engineDoFinal(AndroidKeyStoreCipherSpiBase.java:506)
02-12 18:35:49.789 9791-10394/xx.myapplication W/System.err: ... 20 more

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant