The OpenPGP has been installed correctly and functions well. Below command works in Windows cmd:
gpg2 -r rept --encrypt myfile
However, while we are trying to automate above process using Perl system call:
system("gpg2 -r rept --encrypt myfile");
I got below error message: gpg: rept: skipped: No public key
Using gpg2 --list-keys
, I indeed see the public key added. Could anyone provide with some insights of automating the OpenGPG processes?
Given only few information in the question I can only guess and my guess is that rept
contains a @
which gets interpreted because you have double quotes.
Apart from that please use strict; use warnings;
so that you will find such errors early. Also use the multi-argument version of system
so that no shell is involved, i.e. system("gpg2","-r",....)
. Otherwise you might risk code execution if the rept
or myfile
is determined by user input.