我有一个.sh代码,我在其中签名,并使用带有user_ID的gpg命令加密.gz文件。如何从php库gnupg中获得相同的输出文件?
.sh代码:
gpg -se -r ${GPG_USER} file.csv.gz
输出:
file.csv.gz.gpg
当前尝试代码PHP:
use gnupg;
$gpg = new gnupg();
$gpg->addencryptkey("FINGERPRINT"); //How to find FINGERPRINT?
$gpg->addsignkey("FINGERPRINT","USER_ID"); //How to find FINGERPRINT?
$enc = $gpg->encryptsign(file_get_contents("file.csv.gz"));
$file = fopen("file.csv.gz.gpg","w");
fputs($file, $enc); //is it correct way to export encrypted output file?