|
webpg-npapi 0.6.1
|
Invokes the gpg-agent to change the passphrase for the given key.
Definition at line 2946 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;
gpgme_key_t key = NULL;
FB::VariantMap result;
err = gpgme_op_keylist_start (ctx, keyid.c_str(), 0);
if (err != GPG_ERR_NO_ERROR)
result = get_error_map(__func__, gpgme_err_code (err), gpgme_strerror (err), __LINE__, __FILE__);
err = gpgme_op_keylist_next (ctx, &key);
if (err != GPG_ERR_NO_ERROR)
result = get_error_map(__func__, gpgme_err_code (err), gpgme_strerror (err), __LINE__, __FILE__);
err = gpgme_op_keylist_end (ctx);
if (err != GPG_ERR_NO_ERROR)
result = get_error_map(__func__, gpgme_err_code (err), gpgme_strerror (err), __LINE__, __FILE__);
err = gpgme_data_new (&out);
if (err != GPG_ERR_NO_ERROR)
result = get_error_map(__func__, gpgme_err_code (err), gpgme_strerror (err), __LINE__, __FILE__);
edit_status = "gpgChangePassphrase(keyid='" + keyid + "');\n";
err = gpgme_op_edit (ctx, key, edit_fnc_change_passphrase, out, out);
if (err != GPG_ERR_NO_ERROR)
result = get_error_map(__func__, gpgme_err_code (err), gpgme_strerror (err), __LINE__, __FILE__);
FB::VariantMap response;
if (!key->secret) {
response["error"] = true;
response["result"] = "no secret";
} else {
response["error"] = false;
response["result"] = "success";
}
gpgme_data_release (out);
gpgme_key_unref (key);
gpgme_release (ctx);
if (result.size())
return result;
return response;
}
Here is the call graph for this function:
![]() |
1.7.4