mjwheatley / cordova-plugin-android-fingerprint-auth

A cordova plugin for fingerprint authentication using the hardware fingerprint scanner on devices running Android 6+
Apache License 2.0
169 stars 131 forks source link

Failed to encrypt the data with the generated key: BadPaddingException: javax.crypto.BadPaddingException #128

Open vvarda opened 5 years ago

vvarda commented 5 years ago

Have similar issue, with multiple users (user_1, user_2):

  1. Encrypt user_1 credentials:
    
    const encryptConfig = {
    clientId: <com.sample.sample>,
    username: <user_1>,
    password: <user_1_password>
    };

FingerprintAuth.encrypt(encryptConfig, ...)


2. Encrypt user_2 credentials:

const encryptConfig = { clientId: , username: , password: };

FingerprintAuth.encrypt(encryptConfig, ...)


3. Decrypt works **fine** for both of them (user_1, user_2):

user_1

const decryptConfig = { clientId: , username: , token: };

FingerprintAuth.decrypt(decryptConfig, ...)

user_2

const decryptConfig = { clientId: , username: , token: };

FingerprintAuth.decrypt(decryptConfig, ...)


**BUT..**

4. Delete any of user's cipher (user_1 or user_2):

const deleteConfig = { clientId: , username: };

FingerprintAuth.delete(deleteConfig, ...)


5. Trying to decrypt user_2 credentials

const decryptConfig = { clientId: , username: , token: };

FingerprintAuth.decrypt(decryptConfig, ...)


6. Error received
`E/FingerprintAuth: Failed to encrypt the data with the generated key: BadPaddingException:  javax.crypto.BadPaddingException`

**Additional info**

cordova: 8.1.2 cordova-android: 7.1.4 cordova-plugin-android-fingerprint-auth: 1.5.0

Android: 9.0 Device: Nokia 6.1