Sorry for asking this question but i am not getting clear idea of encrypting and decrypting a folder, I am trying to encrypt a bunch of selected images as mentioned in this post encrypt/decrypt but it is taking lot of time to encrypt bunch of selected images,so i tried to encrypt a folder containing selected images but it is giving me filenotfoundexception:open failed(is a directory) I have updated encrypt function as shown below
static void encrypt() throws IOException, NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeyException {
// Here you read the cleartext.
FileInputStream fis = new FileInputStream(Environment.getExternalStorageDirectory()+"/.myapp/.private");
// This stream write the encrypted text. This stream will be wrapped by another stream.
FileOutputStream fos = new FileOutputStream(Environment.getExternalStorageDirectory()+"/.myapp/.encyrpted");
// Length is 16 byte
SecretKeySpec sks = new SecretKeySpec("MyDifficultPassw".getBytes(), "AES");
// Create cipher
Cipher cipher = Cipher.getInstance("AES");
cipher.init(Cipher.ENCRYPT_MODE, sks);
// Wrap the output stream
CipherOutputStream cos = new CipherOutputStream(fos, cipher);
// Write bytes
int b;
byte[] d = new byte[8];
while((b = fis.read(d)) != -1) {
cos.write(d, 0, b);
}
// Flush and close streams.
cos.flush();
cos.close();
fis.close();}
so how do i encrypt folder sdcard/.myapp/.private so that i can reduce time in encrypting whole bunch of images??