Need suggestions on a good way to encrypt / decrypt data stored in SQLite database on Android

I have sensitive data that is stored in SQLite for an Android application. I need to be able to encrypt when they are saved, but then also decrypt when deserializing from the database. Not sure what my Android options are for this?

+3
source share
6 answers

There is no simple answer. Guess I'm just using something simple to change column values ​​when serializing.

+1
source

Android . / , " ".

Android javax.crypto.

, , , , , .

+5

, SO / zip . OSS, . , db , .

@CommonsWare , / , , . , , .

+1

, , , , ? " " , , " " ( , ). , - , , .

Then use:

In Destroy()to flush the code every time the application is unloaded.

0
source

Try SQLCipher to encrypt the database.

0
source

You can try to create a script in SHA1

public static String encriptSHA1(String password){
        String hash = "";

        try {
            MessageDigest md;
            byte[] buffer, digest;

            buffer = password.getBytes();
            md = MessageDigest.getInstance("SHA1");

            md.update(buffer);
            digest = md.digest();

            for(byte aux : digest) {
                int b = aux & 0xff;
                if (Integer.toHexString(b).length() == 1) hash += "0";
                hash += Integer.toHexString(b);
            }
        } catch (NoSuchAlgorithmException e) {
        }

        return hash;
    }
-2
source

Source: https://habr.com/ru/post/1740495/


All Articles