It seems like gpgconf should be the nice way to edit my gpg.conf
file. However, even reading the documentation, I was unable to figure out how to make a simple change. All I wanted to do is to set the default hash algorithm to SHA256. I ended up just adding
personal-digest-preferences SHA256
to the bottom of gpg.conf
manually, but how could I have achieved this using gpgconf?
From the gpgconf documentation (highlighting added by me):
The
gpgconf
is a utility to automatically and reasonable safely query and modify configuration files in the.gnupg
home directory. It is designed not to be invoked manually by the user, but automatically by graphical user interfaces (GUI).[...] Not all configuration options are available through
gpgconf
.gpgconf
provides a generic and abstract method to access the most important configuration options that can feasibly be controlled via such a mechanism.
But let's see what happens if we try to use it anyway:
$ echo 'personal-digest-preferences:0:SHA256' | gpgconf --change-options gpg
gpgconf: unknown option personal-digest-preferences
gpgconf: fatal error (exit status 1)
Apparently, personal-digest-preferences
does not belong to this set of "most important configuration options" and you should edit the gpg.conf
manually as suggested.