xmrwallet icon indicating copy to clipboard operation
xmrwallet copied to clipboard

Use a Hardware Security Module if available

Open sergimn opened this issue 2 years ago • 1 comments

Is your feature request related to a problem? Please describe. After reviewing the code for a bit, I haven't found that the app uses setIsStrongBoxBacked() to store the passphrase to unlock the wallet inside the secure element in the event that it is available.

Describe the solution you'd like Check if the device has a HSM and use it to store the decryption key for the wallet. This would significantly improve security as the key would never be stored on regular storage but in the HSM, which is rate limited. You could even ditch the concept of a user-generated passphrase in this case and just use the phone's authentication method, which also uses the HSM (and thus is rate limited) and not require to plug in the Ledger device in case the user is using one as the view key is basically impossible to modify as it is encrypted at rest with the key inside the HSM

Additional context You can find more information in the following two links https://developer.android.com/training/articles/keystore#HardwareSecurityModule https://developer.android.com/reference/android/security/keystore/KeyGenParameterSpec.Builder#setIsStrongBoxBacked(boolean)

sergimn avatar Oct 22 '21 18:10 sergimn