-1

I am developing native application targeting android mobiles using Sencha Touch and phonegap. In this app, I am using file plugin to read / write data. These files should be accessible only via this app not via other app and not via USB.

It should be either hidden or encrypted.

Question: How to implement this file security and encryption & decryption or Is there a plugin to implement this?

1 Answers1

1

If you want to store only limited text information(upto 5Mb,temporary storage) you use webstorage with AES encryption using CryptoJS library to encrypt/decrypt the data. Refer this link for CryptoJS
OR
If you want it in native way, you can use AES-256 file encryption with password based key(otherwise reverse engineering can break your encryption) Refer this Q&A for AES encryption/decryption . Since in android java doesnot support AES-256 you need to add Spongy castle (http://rtyley.github.io/spongycastle/) otherwise use AES-128 algorithm. Spring frame for android also provides an abstracted org.springframework.security.crypto.encrypt.AndroidEncryptors class for text encryption.

Community
  • 1
  • 1
Nithin CV
  • 1,046
  • 9
  • 23
  • This is a question, can we encrypt the data using CryptoJS and then store it on the device file system rather than using Spongy castle – Ubaidah Nov 04 '14 at 09:26
  • 1
    I think it can be done(I have no hands on experience in that) because cordova provides File Management API for android. Please refer documentation: http://cordova.apache.org/docs/en/3.3.0/cordova_file_file.md.html#File. – Nithin CV Nov 13 '14 at 18:21