|
webpg-npapi 0.6.1
|
Sets the gnupg trust level assignment for the given keyid.
Definition at line 2432 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 response;
trust_assignment = i_to_str(trust_level);
if (trust_level < 1) {
response["error"] = true;
response["result"] = "Valid trust assignment values are 1 through 5";
return response;
}
err = gpgme_op_keylist_start (ctx, keyid.c_str(), 0);
if (err != GPG_ERR_NO_ERROR)
return 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)
return 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)
return get_error_map(__func__, gpgme_err_code (err), gpgme_strerror (err), __LINE__, __FILE__);
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__);
edit_status = "gpgSetKeyTrust(keyid='" + keyid + "', trust_level='" + i_to_str(trust_level) + "');\n";
err = gpgme_op_edit (ctx, key, edit_fnc_assign_trust, out, out);
if (err != GPG_ERR_NO_ERROR)
return get_error_map(__func__, gpgme_err_code (err), gpgme_strerror (err), __LINE__, __FILE__);
trust_assignment = "0";
gpgme_data_release (out);
gpgme_key_unref (key);
gpgme_release (ctx);
response["error"] = false;
response["result"] = "trust value assigned";
return response;
}
Here is the call graph for this function:
![]() |
1.7.4