Re: Two-way on-the-fly encryption
| From: | David T-G | Date: | Fri, 21 Nov 2003 11:18:15 +0000 |
| Subject: | Re: Two-way on-the-fly encryption | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-170543@lists.php.net to get a copy of this message | ||
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) davidtg@justpickone.org * society and not sufficient moral courage.
(work) davidtgwork@justpickone.org -- Mary Baker Eddy, "Science and Health"
http://justpickone.org/davidtg/ Shpx gur
Pbzzhavpngvbaf Qrprapl Npg!