Hello,

I want to take a String variable and GPG encrypt it, then email the
encrypted string.

One of our developers suggested using "proc_open" and to "set the process to
'gpg -a --encrypt -r 0x35E891B0'", but couldn't clarify.

How is this done? Would it be something like this...?
-----------------------------------------

$message = "Text or HTML string";

$pipes = "-a --encrypt -r 0x35E891B0";

$descriptorspec = array(0 => array("pipe", "r"), 1 => array("pipe", "w"), 2
=> array("file", "/tmp/error-output.txt", "a"));

$process = proc_open("gpg", $descriptorspec, $pipes);

if (is_resource($process)) {
    fwrite($pipes[0], $message);
    fclose($pipes[0]);
    while(!feof($pipes[1])) {
        echo fgets($pipes[1], 1024);
    }
    fclose($pipes[1]);
    $return_value = proc_close($process);
}

send_mail($smtp_server, $smtp_port, $sender_email, $recipient_email,
$subject, $message, $headers);

----------------------------------------

Thank you,
Bob Van

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to