Default configuration of GnuPG preferred chiphers and hashfunctions

Sandra Schreiner sasc0041 at stud.hs-kl.de
Sat Jan 30 10:13:42 CET 2016


Hello again,

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. There is nothing special about how I set the path:

   gpgme_engine_info_t info;
    gpgme_error_t  error;
    const char* dir = "/home/myuser/crypttest";    

    // Initializes gpgme
    gpgme_check_version(NULL);

    // Initialize the locale environment.
    setlocale(LC_ALL, "");
    gpgme_set_locale(NULL, LC_CTYPE, setlocale(LC_CTYPE, NULL));
#ifdef LC_MESSAGES
    gpgme_set_locale(NULL, LC_MESSAGES, setlocale(LC_MESSAGES, NULL));
#endif
   //also tried this, but this didn't work either:
   // error = gpgme_set_engine_info(GPGME_PROTOCOL_OpenPGP, NULL,
   //                               CONFIG_DIR);
    if(error)
        return false;
    error = gpgme_new(&mContext);
    if(error)
        return false;
    // Check OpenPGP
    error = gpgme_engine_check_version(GPGME_PROTOCOL_OpenPGP);
    if(error)
        return false;
    // load engine info
    error = gpgme_get_engine_info(&info);
    if(error)
        return false;
    while(info && info->protocol != gpgme_get_protocol(mContext)) {
        info = info->next;
    }
    // set path to config file
    error = gpgme_ctx_set_engine_info(mContext, GPGME_PROTOCOL_OpenPGP, NULL,
                                      CONFIG_DIR);
    if(error)
        return false;


If I remove the directory in my init function and use a nullptr (for default), the same key generation succeeds. I don't know why this happens. I have read and write access to this directory and tried various other directories (also including the closing / at the end), but without luck.

Moreover I searched for information about the default (preferreed) 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. Neither on my windows system in %APPDATA%\gnupg or my Debian system (both have GnuPG installed). How can I figure this out?

Im using gpg2 2.0.26 and GPGME 1.5.1 in 64 bit Debian VM on Windows 7 64 bit Host System.
Many thanks in advance,

Sandra


More information about the Gnupg-users mailing list