Hello i am searching free api or some easy code to encrypt and decrypt pdf files. Encryption should be done on downloading file from a stream:
while ((bufferLength = inputStream.read(buffer)) > 0) {
/*
* Writes bufferLength characters starting at 0 in buffer to the target
*
* buffer the non-null character array to write. 0 the index
* of the first character in buffer to write. bufferLength the maximum
* number of characters to write.
*/
fileOutput.write(buffer, 0, bufferLength);
}
And decrypt when need to open with pdf reader. Maybe there are some info, code or free Api for this ?
Someone had done something like this ?
I found myself some code and api. But nothing good for now.
Thanks.
You can try like this using CipherOuputStream and CipherInputStream:
Encryption:
Decryption: