OK, so I need to put the data into the out stream. Can you give some sample code from C doing this? I'm not 100% clear on the order, etc of calling gpg and sending the data to "out." Thanks!
--- On Thu, 12/18/08, David Shaw <ds...@jabberwocky.com> wrote: > From: David Shaw <ds...@jabberwocky.com> > Subject: Re: How encrypt data/text stream instead of a file? > To: donrhu...@yahoo.com > Cc: gnupg-users@gnupg.org > Date: Thursday, December 18, 2008, 10:52 AM > On Dec 18, 2008, at 1:14 AM, don rhummy wrote: > > > All the examples of using GnuPG are of giving it a > local filename to encrypt or decrypt. How do I pass it data, > either as a stream or byte by byte? > > GnuPG is designed to be able to accept a stream or a file. > To do a stream instead of a file, just don't give a > filename. GnuPG will then read data from standard input. > > So, for example: > > my-pipeline-that-streams-data | gpg --encrypt | > my-pipeline-that-accepts-encrypted-data > > You can freely mix streams and files as well: > > my-pipeline-that-streams-data | gpg -o output-file.gpg > --encrypt > > Or > > gpg -o - --encrypt myfile | > my-pipeline-that-accepts-encrypted-data > > Anyway, that's how you do it on the command line. If > you want to do it inside a program, it depends on what > language you're using and how that language deals with > calling out to a command line. In general, though, you want > to write data to the head of the GPG pipe, and read data > from the tail of the GPG pipe. I do this frequently in C > via the usual pipe/fork/exec/dup2 method. > > David _______________________________________________ Gnupg-users mailing list Gnupg-users@gnupg.org http://lists.gnupg.org/mailman/listinfo/gnupg-users