I need to generate and sign a file with a pgp certification. My problem is the certification sign.
I have tried to use OpenPGP API (https://didisoft.com/java-openpgp/) but it looks that doesn't do anything
PGPLib pgp = new PGPLib();
boolean asciiArmor = true;
boolean withIntegrityCheck = false;
String privateKeyFile = "private.asc"; --> exported private key (gpg --output private.asc --armor --export-secret-key my_mail)
String privateKeyPassword = "my_passphrase";
String publicEncryptionKeyFile = "public.asc"; --> exported public key (gpg --output public.asc --armor --export my_mail)
pgp.signAndEncryptFile("INPUT.txt",privateKeyFile,privateKeyPassword,publicEncryptionKeyFile,"encrypted.pgp",asciiArmor);
This last command generates the encrypted.pgp file, but its not signed
**$gpg --verify encrypted.pgp
gpg: verify signatures failed: Unexpected error**
I tried to use ProcessBuilder with gpg --clearsing command, but it requires interaction from the user (asks for the passphrase in command line).
Anyone has experience with PGPLib or knows how to interact with ProccessBuilder?
I tried to use PGPLib signFile methods, and PorcessBuilder commands, but the final file is not signed when I check it with gpg --verify