Internal storage

Internal storage is yet another way of storing data in Android Apps, usually in the file directory under /data/data/<app name>.

The following code shows how the internal storage is used to store the private key of an application, which it is used to store and send credit card and SSN numbers of a user:

            String publicKeyFilename = "public.key";
            String privateKeyFilename = "private.key";

        try{
            GenerateRSAKeys generateRSAKeys = new GenerateRSAKeys();
            Security.addProvider(new org.bouncycastle.jce.provider.BouncyCastleProvider());

            // Generate public & private keys
            KeyPairGenerator generator = KeyPairGenerator.getInstance("RSA", "BC"); //create base64 handler BASE64Encoder b64 = new BASE64Encoder(); //Create random number SecureRandom ...

Get Hacking Android now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.