Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

How do I determine if the PGP commandline worked?

0
10 Posted

How do I determine if the PGP commandline worked?

0

Normally, PGP runs in “interactive” mode, and so you can always read on the screen what went wrong, where and hopefully why. But if you want to use PGP in a batch file, or in the background, you need to find out if the operation was successful in another way. The usual approach for this is to use the “exit code” returned by PGP. To be able to detect if PGP could do what you asked, you need to add the +batchmode option to the command line. (To avoid getting “stuck” at prompts asking you to choose “yes” or “no”, add the +force option). PGP will then return 0 if everything went ok, and non-zero if something went wrong. The PGP source contains a list of exit codes that are supposed to be returned when the associated events occur. It seems that this does not always work as expected. For example, PGP should return exit code 31 when no passphrase was specified to decrypt the file, but if you try to check a signature, exit code 1 is used to indicate any error, including “No key to check signat

Related Questions

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.