GPGTools/Libmacgpg — pull request #15 by idodeclare (2012-05-22 15:46:26+00:00)
Title: Add GPGStream-based methods to GPGController.

Hi. I've updated GPGController with versions of processData, decryptData, and
verifySignature to take a new stream object, GPGStream (with GPGMemoryStream
and GPGFileStream concrete subclasses). The previous methods operate as
before—though on top of implicit GPGStreams.

They do buffered reading of data to/from gpg2 using memory or the filesystem
and so will let GPGServices' file operations keep essentially the same memory
footprint when operating on any size of file. (I have a version of GPGServices
ready to go to use this).

As you know, right now operating on files pulls their entire contents as well
as the GPG output into memory even though it's just being saved to disk.

I looked into using NSStream and its subclasses, but that API is a bit stunted.
Libmacgpg's previous direct usage of NSData made it easier if the new stream
objects supported seekability, peeking, and length determination, which
NSInputStream does not.

also:
- fix minor memory leak with detached-signed files
- "Process data failed!" is now "Encrypt/sign failed!"

NOTE:
If GPGDebugLog is YES, the following will still read all of stdout into memory,
though the if-statement is new:

if ([GPGOptions debugLog])
[self logDataContent:[self outData] message:@"[STDOUT]"];