please am working on app that store sensitive user data on a database upon googling on how to do the answers point me to cwac saferoom since am using room for my database but the problem am facing are:
Cwac saferoom required i pass in an edittable object meani g the same method i call on edittext to get the input string as passphrase i dont really know how make a that object out of a string
How do i safely store the password on the device also
Please am using java
Quoting the documentation: "The
SafeHelperFactoryconstructor takes a either abyte[]or achar[]for the passphrase.". There is a utility method that takes anEditable, for the recommended path of getting the passphrase from the user. So, just create aSafeHelperFactoryobject via the constructor:It is not a good idea to have a passphrase in a
String. See:But, for tests and stuff, call
toCharArray()on yourStringto get achar[]to pass to theSafeHelperFactoryconstructor:Generally, you don't. You get the passphrase from the user.
If your
minSdkVersionis 23 or higher, you could useandroidx.security:security-cryptoclasses to store a generated passphrase in hardware-encrypted storage.