Encrypt/decrypt large files with PGP SDK securely
I'm trying to create test program using PGP SDK which can be embedded into our application (that processes the plain files further).
- One way is to first decrypt file into a temporary file and then pass the temporary file to our application. I don't like this approach as the decrypted file stays for sometime so not a secure option.
- Another way is to use PGP command line which writes decrypted text to stdout and have our application read the stdout. I'd like to achieve this using PGP SDK. Is it possible? I could not find appropriate Filespec classes in PGP SDK that can be used to achieve this. I think current PGPNewFileSpecFromFullPath() does not allow stdout or stdin as parameters or does it?
- Yet another way is to provide an event to allow PGP SDK calling program to read in chunks. Current kPGPEvent_OutputEvent only allows caller to provide a static buffer of fixed size. If the size of the buffer is not enough then the PGPDecode() fails. Is there anyway to allow caller to read the data in chunks? This is similar to using input or outputstreams of Java.
How does PGPEncode() encrypts large files? Does it create one encrypted message section for the entire file or it is divided into a packets of a certain sizeAppreciate any help on this. I don't see a separate community for PGP SDK so posting it here.