File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed
android/src/main/java/com/oblador/keychain/cipherStorage Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -339,7 +339,7 @@ abstract class CipherStorageBase(protected val applicationContext: Context) : Ci
339
339
340
340
/* * Decrypt provided bytes to a string. */
341
341
@SuppressLint(" NewApi" )
342
- @Throws(GeneralSecurityException ::class , IOException ::class )
342
+ @Throws(GeneralSecurityException ::class , IOException ::class , CryptoFailedException :: class )
343
343
protected open fun decryptBytes (
344
344
key : Key ,
345
345
bytes : ByteArray ,
@@ -361,7 +361,14 @@ abstract class CipherStorageBase(protected val applicationContext: Context) : Ci
361
361
e.cause?.message?.contains(" Key user not authenticated" ) == true -> {
362
362
throw UserNotAuthenticatedException ()
363
363
}
364
-
364
+ e is javax.crypto.AEADBadTagException -> {
365
+ throw CryptoFailedException (
366
+ " Decryption failed: Authentication tag verification failed. " +
367
+ " This usually indicates that the encrypted data was modified, corrupted, " +
368
+ " or is being decrypted with the wrong key." ,
369
+ e
370
+ )
371
+ }
365
372
else -> throw e
366
373
}
367
374
}
You can’t perform that action at this time.
0 commit comments