Default configuration of GnuPG preferred chiphers and hashfunctions

Robert J. Hansen rjh at sixdemonbag.org
Sat Jan 30 11:27:48 CET 2016


> I somehow can't get GPGME to work with a custom configuration
> directory for GnuPG. Every time I set a path any key generation fails
> with a GPGME_ERR_GENERAL afterwards.

Let's tackle this.

> const char* dir = "/home/myuser/crypttest";

So far so good.

> // error = gpgme_set_engine_info(GPGME_PROTOCOL_OpenPGP, NULL, 
> // CONFIG_DIR);
> 
> error = gpgme_ctx_set_engine_info(mContext, GPGME_PROTOCOL_OpenPGP, 
> NULL, CONFIG_DIR);

Shouldn't CONFIG_DIR be dir?  I'm guessing you have CONFIG_DIR defined
somewhere else in your project and it's sending you off-course.  If
you've already tried gpgme_set_engine_info(GPGME_PROTOCOL_OpenPGP,
nullptr, dir) though, ignore me.  :)

Also, a C++ tip: never use NULL.  NULL is defined to be 0.  If you need
the numeric value zero, use 0; if you need a pointer to null, use
nullptr.  Wikibooks has a good article on this:

	https://en.wikibooks.org/wiki/More_C%2B%2B_Idioms/nullptr

> Moreover I searched for information about the default (preferred) 
> order of GnuPG for ciphers and hashfunctions. But didn't found 
> something. There doesn't seem to be any gpg.conf file on my PC.

You don't need a gpg.conf file, but if you want one, check the GnuPG
FAQ.  There's a sample gpg.conf file in there that sets default cipher
preferences.  The lines you'll want to change/modify are
"personal-*-preferences".



More information about the Gnupg-users mailing list