Ray --

...and then Ray said...
% 
% I want to do two-way encryption on a file coming through the web server.  In

That's an interesting name for it.


% this context, I would want to generate a public and private key, encrypt the
% file stream (i.e., don't want to write the unencrypted file to disk first
% and then encrypt it; I want to encrypt the stream as it comes in) with the

OK.  Be aware that it will possibly get written to disk, though.


% public, send the private to the recipient, and then destroy both keys on my
% end.

Hmmm...  *thinks*  I can't remember if a private key alone is sufficient
to decrypt, although the public key alone is certainly enough to encrypt.
You might check on that.


% 
% When the file was accessed and the private key was provided, I would want to
% stream the unencrypted file out without ever writing the unencrypted file to
% disk.

Note that your clear text could very well get written to disk: you are
very likely to have a swap space.  I don't know of any way to tell php
that you don't want it (or really the OS) to lock some chunk in memory.


% 
% Any ideas on how to accomplish this within the PHP construct?

Well, gnupg can encrypt and decrypt a stream, and there is a GNUPG class
at phpclasses.org, so I would probably leave all of the encryption and
key work to it and go that way.

If you really wanted to be secure, you might implement some javascript
or a java applet to encrypt it before it ever left the browser (and,
similarly, decrypt it when it's requested later); then you only ever
deal with the encrypted version (ick -- I can't believe I just suggested
J-anything).


% 
% Thanks!

So what in the world is this data which must be so secure that even you
can't see it?


HTH & HAND

:-D
-- 
David T-G                      * There is too much animal courage in 
(play) [EMAIL PROTECTED] * society and not sufficient moral courage.
(work) [EMAIL PROTECTED]  -- Mary Baker Eddy, "Science and Health"
http://justpickone.org/davidtg/      Shpx gur Pbzzhavpngvbaf Qrprapl Npg!

Attachment: pgp00000.pgp
Description: PGP signature

Reply via email to