I am trying to encrypt and sign a file using GPG but receiving the timeout error. The command works and it encrypts the file when I skip the ‘–sign’ option. I tried to just sign the file. But that did not work either.
Hallo, bei --sign wird dein secret key benötigt und daher halt auch die passphrase um deinen secret key zu entsperren. Wenn du die Passphrase eh in das batch Kommando schreibst wäre es vielleicht eine überlegung die Passphrase komplett von deinem key zu entfernen.
Dein Kommando würde aber auch funktionieren wenn du “–pinentry-mode loopback” noch mit einfügst. Das ist auch in all unserer Dokumentation dazu beschrieben. Habe ich extra hinzugefügt weil das eines der häufigsten Probleme ist
--passphrase string
Use string as the passphrase. This can only be used if only one passphrase is supplied. Obviously, this is of very questionable security on a multi-user system. Don’t use this option if you can avoid it.
Note that since Version 2.0 this passphrase is only used if the option --batch has also been given. Since Version 2.1 the --pinentry-mode also needs to be set to loopback.
Oh sorry, I wrote my reply in german. Here it is in english again:
With --sign gnupg needs to access your secret key so it requires the passphrase for it. If you write it in a batch file anyway it might be better to remove the passphrase altogether from your secret key.
Your command wold work though if you added “–pinentry-mode loopback” GPG Esoteric Options (Using the GNU Privacy Guard) This is explicitly mentioned in our documentation since that is one of the most common problems when using passphrase options on the command line.
And yes I am constantly arguing with the maintainer of GnuPG to “imply” pinentry-mode loopback automatically when one of the passphrase options is used…
In another discussion, I saw that we can actually update the gpg.conf by adding ‘pinentry-mode loopback’ to avoid the pinentry launch.
But I could not locate the gpg.conf file. I tried searching on c:\users\yourname\AppData\Roaming.
It seems you meanwhile noticed that you had to add “–pinentry-mode loopback" additionally to the --passphrase for decryption, too, if you can’t use pinentry.
And yes, if you want to always use the option, you can add it in the gnupg.conf instead of giving it on the command line.
You are looking in the right place for the gpg.conf, the default location is in c:\users\yourname\AppData\Roaming\gnupg . To be more precise, it is %APPDATA%\gnupg which resolves usually to the above nowadays.
If there is no gnupg.conf in that folder, just create it and put the options you want in there.
Thank you for your advice, which is completely correct except for one important detail: The file is called “gpg.conf” a file with name “gnupg.conf” will have no effect!