I sent this off a couple days ago, but did not see it on the list ...
please excuse the traffic if you are seeing this for a second time.
I am writing some code (PHP3/4 on Apache) that encrypts some text using
PGP and writes it to a log_file. I am having problems getting the line
breaks to remain intact from the original unencrypted version to the
final decrypted version.
Here's my code:
// first I setup a variable with the message to be encrypted,
// note the line breaks
$msg = "
* * * * * * * * * *
BILL TO:
$type_of_card $card_number
$users_name ($expiration_date)
$b_first_name $b_last_name
$b_address_1
$b_address_2
$b_city, $b_state $b_zip
$b_day_phone $b_night_phone
$b_email
* * * * * * * * * *
";
// next I set the environment variable for PGPPATH
putenv("PGPPATH=/.pgp");
// then I place the message that is to be encrypted in a file
$fp = fopen("plaintxt", "w+");
fputs($fp, $msg);
fclose($fp);
// fyi ... if at this point, if I were to open the file plaintxt
// all of my line breaks would still be there
// next I encrypt the data and write it to a file called crypted
system("/usr/local/bin/pgpe -r [EMAIL PROTECTED] -o crypted -a
plaintxt");
unlink("plaintxt");
// now ... if at this point I were to open the file crypted and decrypt
it
// I would get my message in a long line with squares where every break
should be
// here's the method I use to get this crypted data added to my log file
$fd = fopen("crypted", "r");
$msg_crypted = fread($fd, filesize("crypted"));
fclose($fd);
unlink("crypted");
$order_log = fopen("order_log", "a");
fwrite($order_log, $msg_crypted);
fclose($order_log);
So, if anyone can help me figure out a way to keep these line breaks in
place all the way through to decryption, I would be VERY appreciative.
I know this is possible ... because, if I take the same message from my
code and place it in a text editor ... encrypt and decrypt it using my
desktop PGP software ... all of the line breaks remain intact.
Please help!
Thanks,
Nick
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]