Encrypt from InputStream, decrypt to OutputStream

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

Encrypt from InputStream, decrypt to OutputStream

Korhonen Tommi
Hello all!

As a newbie of Bounty Castle PGP I'm looking for a simple Java example of PGP encrypt/decrypt where

1) data to be encrypted is read from InputStream and then written to filesystem as encrypted file
2) file to be decrypted is read from filesystem and then outputted to OutputStream as decrypted data

If I understood correctly, the nice example at https://github.com/bcgit/bc-java/blob/master/pg/src/main/java/org/bouncycastle/openpgp/examples/KeyBasedFileProcessor.java does the opposite: encrypts from file to OutputStream and decrypts from InputStream to file.

Best Regards,
Tommi K.