Use gpg command (over gpg2) with specific homedir

This commit is contained in:
Joshua Ramon Enslin 2020-11-08 00:43:39 +01:00 committed by Stefan Rohde-Enslin
parent 5b34e63dd5
commit 187029a36b
Signed by: jrenslin
GPG Key ID: 46016F84501B70AE

View File

@ -23,7 +23,7 @@ final class MDMailerHelper {
*/
public static function pgp_encrypt(string $to, string $msg):string {
$msg = shell_exec("echo " . escapeshellarg($msg) . " | gpg2 --always-trust --recipient " . escapeshellarg($to) . " --encrypt --armor --local-user " . escapeshellarg(MD_CONF_EMAIL::PGP_ENC_KEY) . " --sign");
$msg = shell_exec("echo " . escapeshellarg($msg) . " | gpg --always-trust --homedir " . escapeshellarg(MD_CONF_EMAIL::PGP_HOMEDIR) . " --recipient " . escapeshellarg($to) . " --encrypt --armor --local-user " . escapeshellarg(MD_CONF_EMAIL::PGP_ENC_KEY) . " --sign");
if ($msg === null) return "Error encrypting message";
return $msg;