+Sensitive information that is stored unencrypted in a database is accessible to an attacker +who gains access to that database. For example, the information could be accessed by any +process or user in a rooted device, or exposed through another vulnerability. +
++Either encrypt the entire database, or ensure that each piece of sensitive information is +encrypted before being stored. In general, decrypt sensitive information only at the point +where it is necessary for it to be used in cleartext. Avoid storing sensitive information +at all if you do not need to keep it. +
++The following example stores sensitive information into a database without encryption, using the +SQLx library: +
++This is insecure because the sensitive data is stored in cleartext, making it accessible to anyone +with access to the database. +
++To fix this, we can either encrypt the entire database or encrypt just the sensitive data before it +is stored. Take care to select a secure modern encryption algorithm and put suitable key management +practices into place. In the following example, we have encrypted the sensitive data using 256-bit +AES before storing it in the database: +
+