Important: Please read the Qt Code of Conduct -

QCA win32 pgp keys problem

  • Hello. I have Qt 4.8.5 mingw32 and I installed QCA binary from "here":
    Here is output of QCA::supportedFeatures():

    ("random", "md5", "sha1", "keystorelist", "pgpkey", "openpgp", "log", "sasl", "sha0", "ripemd160", "md4", "sha224", "sha256", "sha384", "sha512", "hmac(md5)", "hmac(sha1)", "hmac(sha224)", "hmac(sha256)", "hmac(sha384)", "hmac(sha512)", "hmac(ripemd160)", "aes128-ecb", "aes128-cfb", "aes128-cbc", "aes128-cbc-pkcs7", "aes128-ofb", "aes192-ecb", "aes192-cfb", "aes192-cbc", "aes192-cbc-pkcs7", "aes192-ofb", "aes256-ecb", "aes256-cbc", "aes256-cbc-pkcs7", "aes256-cfb", "aes256-ofb", "blowfish-ecb", "blowfish-cbc-pkcs7", "blowfish-cbc", "blowfish-cfb", "blowfish-ofb", "tripledes-ecb", "tripledes-cbc", "des-ecb", "des-ecb-pkcs7", "des-cbc", "des-cbc-pkcs7", "des-cfb", "des-ofb", "cast5-ecb", "cast5-cbc", "cast5-cbc-pkcs7", "cast5-cfb", "cast5-ofb", "pbkdf1(sha1)", "pbkdf2(sha1)", "pkey", "dlgroup", "rsa", "dsa", "dh", "cert", "csr", "crl", "certcollection", "pkcs12", "tls", "cms", "ca")

    But I can't load pgp keys.

    QFile file("C:\20140715_Client_CF8EB0A_public.asc"); | QIODevice::Text);
    QCA::ConvertResult res;
    QCA::PGPKey key = QCA::PGPKey::fromArray(file.readAll(), &res);
    qDebug() << "res " << res << " good " << QCA::ConvertGood;

    if (res == QCA::ConvertGood)
        qDebug() << "Convert good!";
        qDebug() << "Convert bad!";


    Here is output:
    res 1 good 0
    Convert bad!
    It's always failed, what's wrong?

  • Moderators

    A shot in the dark, but maybe try to read the file in binary mode (i.e. without QIODevice::Text) ?

  • Thanks for your reply. The same issue :-(
    Maybe I link with QCA wrong ...
    I just added LIBS += -lqca2
    How should I do this?

  • Moderators

    Some obvious questions first.

    Did you download the right binary (i.e. same compiler) or compiled it yourself?. The page says it depends on Qt 4.2 so maybe you need to build it from source with Qt 4.8.5?

    Do you have all the required dependencies? The page says it depends on external plugins for most of the functionality.

  • No, I didn't build it myself.
    I have openssl libs.
    What's files I need for gnupgp?

  • I have installed gnupgp in system, but I don't know how should it work with Qt*

  • I found the reason, I saw qca diagnoting.
    Here the reason:

    C:\Program Files\GNU\GnuPG\gpg.exe --no-tty --no-default-keyring --keyring C:/DOCUME~1/Admin/LOCALS~1/Temp/qca_gnupg_tmp.KcC784.gpg --secret-keyring C:/DOCUME~1/Admin/LOCALS~1/Temp/qca_gnupg_tmp.WYv784.gpg --import

    Can you help?
    I tried write in command line:

    C:\binaries\binaries>gpg --no-tty --no-default-keyring --keyring C:/DOCUME~1
    in/LOCALS~1/Temp/qca_gnupg_tmp.KcC784.gpg --secret-keyring C:/DOCUME~1/Admin
    ALS~1/Temp/qca_gnupg_tmp.WYv784.gpg --import --verbose
    gpg: can't create C:/Documents and Settings/Admin/Application Data/gnupg\C: UME~1/Admin/LOCALS~1/Temp/qca_gnupg_tmp.WYv784.gpg.lock': gpg: can't allocate lock forC:/Documents and Settings/Admin/Application Da
    gpg: keyblock resource C:/Documents and Settings/Admin/Application Data/gnu :/DOCUME~1/Admin/LOCALS~1/Temp/qca_gnupg_tmp.WYv784.gpg': глобальная ошибка gpg: can't createC:/Documents and Settings/Admin/Application Data/gnupg\C:
    gpg: can't allocate lock for C:/Documents and Settings/Admin/Application Da nupg\C:/DOCUME~1/Admin/LOCALS~1/Temp/qca_gnupg_tmp.KcC784.gpg' gpg: keyblock resourceC:/Documents and Settings/Admin/Application Data/gnu
    :/DOCUME~1/Admin/LOCALS~1/Temp/qca_gnupg_tmp.KcC784.gpg': global error

    What I do wrong?

  • Thanks for your comment, but it doesn't make a sence. You write trash which leads to no result.
    Can you say something about subject?

    GPGProc: Running: [C:\Program Files\GNU\GnuPG\gpg.exe --no-tty --no-default-keyring --keyring C:/DOCUME~1/Admin/LOCALS~1/Temp/qca_gnupg_tmp.KE2200.gpg --secret-keyring C:/DOCUME~1/Admin/LOCALS~1/Temp/qca_gnupg_tmp.cg2200.gpg --import]
    GPGProc: Process started
    GPGProc: Process finished: 2
    GPGProc: Done
    GPG Process Finished: exitStatus

    Why it happens?

  • I use linux :-)
    app works well on mac and linux, but windows makes problems, it should be crossplatform app.

  • First you need to have gpg.exe in PATH on Windows. Note old QCA from [] supports only gpg name and not gpg2. Anyway you can use any gpg version 1 or gpg version 2. gpg version 2 is more suitable for desktop.

    About you problem try to get diagnostic output with

Log in to reply