webpg-npapi 0.6.1
FB::variant webpgPluginAPI::gpgExportPublicKey ( const std::string &  keyid)

Exports the public key specified with keyid as an armored ASCII encoded PGP Block.

Parameters:
keyidThe ID of the Public key to export.
Returns:
FB::variant response
response {
    "error":false,
    "result":"—————BEGIN PGP PUBLIC KEY BLOCK—————
            Version: GnuPG v1.4.11 (GNU/Linux)

            mQENBE4u4h8BCADCtBh7btjjKMGVsbjTUKSl69M3bbeBgjR/jMBtYFEJmC0ZnPE9
            ... truncated ...
            uOIPbsuvGT06lotLoalLgA==
            =bq+M
            —————END PGP PUBLIC KEY BLOCK—————"
}

Definition at line 2781 of file webpgPluginAPI.cpp.

References get_gpgme_ctx().

Referenced by webpgPluginAPI().

{
    gpgme_ctx_t ctx = get_gpgme_ctx();
    gpgme_error_t err;
    gpgme_data_t out = NULL;
    FB::variant keydata;
    FB::VariantMap response;

    err = gpgme_data_new (&out);
    if (err != GPG_ERR_NO_ERROR)
        return get_error_map(__func__, gpgme_err_code (err), gpgme_strerror (err), __LINE__, __FILE__);

    err = gpgme_op_export (ctx, keyid.c_str(), 0, out);
    if (err != GPG_ERR_NO_ERROR)
        return get_error_map(__func__, gpgme_err_code (err), gpgme_strerror (err), __LINE__, __FILE__);

    gpgme_data_seek(out, 0, SEEK_SET);

    size_t out_size = 0;
    std::string out_buf;
    out_buf = gpgme_data_release_and_get_mem (out, &out_size);
    /* strip the size_t data out of the output buffer */
    out_buf = out_buf.substr(0, out_size);
    /* set the output object to NULL since it has
        already been released */
    out = NULL;

    gpgme_release (ctx);

    response["error"] = false;
    response["result"] = out_buf;

    return response;
}

Here is the call graph for this function:

 All Classes Functions