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!
From: David Shaw <dshaw at jabberwocky.com>
Subject: Re: How encrypt data/text stream instead of a file?
To: donrhummy at yahoo.com
Cc: gnupg-users at gnupg.org
Date: Thursday, December 18, 2008, 10:52 AM
Post by don rhummyAll 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.
my-pipeline-that-streams-data | gpg --encrypt |
my-pipeline-that-accepts-encrypted-data
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