mibrito707 / cordova-plugin-secure-storage-echo

Secure storage plugin for Apache Cordova
MIT License
73 stars 73 forks source link

Trouble with emulator #7

Open oddcb opened 5 years ago

oddcb commented 5 years ago

Hi. Inside encryptionKeysAvailable() in RSA.java there is a check for keyInfo.isInsideSecureHardware(). In the emulator this method seems to returns false (Tested in P/Q emulators). In turn when the app is relaunched the key for the app is regenerated. Screen lock setup with pin and fingerprint in the emulator.

Do you know of any workarounds? The plugin otherwise seems to work as intended on a physical device (Pixel 2)

pravinkumart commented 4 years ago

I am also facing the same issue. Any solutions?

lnthai2002 commented 4 years ago

Hello, I'm having the same issue. My understanding is that the device need to have physical chip providing a Trusted Execution Environment (TEE) in order for the keyInfo.isInsideSecureHardware() to return true. If this is true, that means we cannot test storing/retrieving key on emulator. Does anyone know if all physical android devices has TEE ?

lnthai2002 commented 4 years ago

To work around this ON EMULATOR, i modified platforms\android\app\src\main\java\com\crypho\plugins\RSA.java to return true in method isEntryAvailable() (replace "return keyInfo.isInsideSecureHardware()" with "return true") to bypass the TEE test. Then rebuilt and redeployed to emulator. Please remember to revert this change BEFORE building for real device