|
webpg-npapi 0.6.1
|
Creates a threaded worker to run the gpg keygen operation.
Definition at line 2054 of file webpgPluginAPI.cpp. References get_gpgme_ctx(), restoreGPGConfig(), and setTempGPGOption(). Referenced by threaded_gpgGenSubKey(). {
// Set the option expert so we can access all of the subkey types
setTempGPGOption("expert", "");
gpgme_ctx_t ctx = get_gpgme_ctx();
gpgme_error_t err;
gpgme_data_t out = NULL;
gpgme_key_t key = NULL;
FB::VariantMap response;
gen_subkey_type = subkey_type;
gen_subkey_length = subkey_length;
gen_subkey_expire = subkey_expire;
gen_sign_flag = sign_flag;
gen_enc_flag = enc_flag;
gen_auth_flag = auth_flag;
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__);
gpgme_set_progress_cb (ctx, cb_status, APIObj);
edit_status = "gpgGenSubKeyWorker(keyid='" + keyid + "', subkey_type='" + subkey_type +
"', subkey_length='" + subkey_length + "', subkey_expire='" + subkey_expire + "', sign_flag='" +
i_to_str(sign_flag) + "', enc_flag='" + i_to_str(enc_flag) + "', auth_flag='" +
i_to_str(auth_flag) + "');\n";
err = gpgme_op_edit (ctx, key, edit_fnc_add_subkey, out, out);
if (err != GPG_ERR_NO_ERROR) {
if (gpg_err_code(err) == GPG_ERR_CANCELED)
this->FireEvent("onkeygencomplete", FB::variant_list_of("failed: cancelled"));
else if (gpg_err_code(err) == GPG_ERR_BAD_PASSPHRASE)
this->FireEvent("onkeygencomplete", FB::variant_list_of("failed: bad passphrase"));
return get_error_map(__func__, gpgme_err_code (err), gpgme_strerror (err), __LINE__, __FILE__);
}
gpgme_data_release (out);
gpgme_key_unref (key);
gpgme_release (ctx);
// Restore the options to normal
restoreGPGConfig();
const char* status = (char *) "complete";
cb_status(APIObj, status, 33, 33, 33);
return "done";
}
Here is the call graph for this function:
![]() |
1.7.4