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
339339
340340 /* * Decrypt provided bytes to a string. */
341341 @SuppressLint(" NewApi" )
342- @Throws(GeneralSecurityException ::class , IOException ::class )
342+ @Throws(GeneralSecurityException ::class , IOException ::class , CryptoFailedException :: class )
343343 protected open fun decryptBytes (
344344 key : Key ,
345345 bytes : ByteArray ,
@@ -361,7 +361,14 @@ abstract class CipherStorageBase(protected val applicationContext: Context) : Ci
361361 e.cause?.message?.contains(" Key user not authenticated" ) == true -> {
362362 throw UserNotAuthenticatedException ()
363363 }
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+ }
365372 else -> throw e
366373 }
367374 }
You can’t perform that action at this time.
0 commit comments