Search code examples
bashgnupg

suppress warning messages in gnupg


I was using gpg to just for encryption and decryption purpose.

the commands I used are:

for enc:
gpg --sign test
for dec:
gpg --decrypt test.gpg > test

but I am getting below warning messages :

gpg: Signature made Fri Jun 24 17:29:00 2016 UTC using RSA key ID XXXX
gpg: Good signature from "XXXX@xxxx.com>"
gpg: WARNING: This key is not certified with a trusted signature!
gpg: There is no indication that the signature belongs to the owner.

off course I have tried with --status-fd, --no-comment, --no-mdc-warning,--no-tty ,--no-verbose --quiet --batch, --no-greeting etc based on Internet search.

Is there a way to get rid off these warning messages ?

As a last option, I am using How to hide command output in bash

But I think there should be an easy method to suppress warning in gpg.


Solution

  • The warning is being shown on STDERR, you can redirect the STDERR stream to /dev/null to get rid of the warning:

    gpg --decrypt test.gpg 2>/dev/null
    

    Saving the STDOUT too:

    gpg --decrypt test.gpg 2>/dev/null >test