Skip to content Skip to sidebar Skip to footer

Unable To Decrypt A File Using Cipher Class

I wanted to encrypt a file based on a password, so I used the following code: private void encrypt(String password) { SecretKeyFactory f = SecretKeyFactory.getInstance('PBKDF2W

Solution 1:

try

while ((len = bis.read(buff)) > 0) {
if(input.available() == 0){
  // use descryped file here
  // you can use callback methods
   }
    output.write(buff, 0, len);
}

here, inputstream keeps reducing its availability, but it tries after 0 also. Because you did not use cipher.doFinal(fileData.getBytes()).


Post a Comment for "Unable To Decrypt A File Using Cipher Class"