To access application data, one can use offline authentication implemented by encryption methods. Encryption is provided using methods of the OpenSSL 1.1.0g library.
Offline authentication scenario:
Authentication must be executed online at the first time. The user enters login and password. Credentials are checked for correctness.
The mobile application accepts login and password entered by the user and generates a single-string parameter from them.
The SHA-256 hash function is applied to the obtained parameter. An additional key (salt) is added to the string with calculated result of hash function, after which the SHA-256 hash function is again applied to the obtained string.
The obtained result is used as a key sent to open and decrypt data from mobile device database.
If the database is successfully opened, the user is considered authenticated and can start work with the application without connection to a mobile platform server.
NOTE. The generated encryption/decryption key is located only in application RAM, which prevents from getting access to data by direct connection to the file system.
See also: