webpg-npapi 0.6.1
FB::variant webpgPluginAPI::gpgRevokeItem ( const std::string &  keyid,
const std::string &  item,
int  key_idx,
int  uid_idx,
int  sig_idx,
int  reason,
const std::string &  desc 
)

Revokes a give key, trust item, subkey, uid or signature with the specified reason and description.

Parameters:
keyidThe ID of the to revoke, or the ID of the key that contains the subitem passed.
itemThe item to revoke.
key_idxThe index of the subkey to revoke.
uid_idxThe index of the UID to revoke.
sig_idxThe index of the signature to revoke.
reasonThe gnupg reason for the revocation.
descThe text description for the revocation.

Definition at line 2830 of file webpgPluginAPI.cpp.

References get_gpgme_ctx().

Referenced by gpgRevokeKey(), gpgRevokeSignature(), and gpgRevokeUID().

{

    gpgme_ctx_t ctx = get_gpgme_ctx();
    gpgme_error_t err;
    gpgme_data_t out = NULL;
    gpgme_key_t key = NULL;
    FB::VariantMap response;

    key_index = i_to_str(key_idx);
    current_uid = i_to_str(uid_idx);
    current_sig = i_to_str(sig_idx);
    revitem = item.c_str();
    reason_index = i_to_str(reason);
    description = desc.c_str();


    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 = "gpgRevokeItem(keyid='" + keyid + "', item='" + item + "', key_idx='" + 
        i_to_str(key_idx) + "', uid_idx='" + i_to_str(uid_idx) + "', sig_idx='" + i_to_str(sig_idx) +
        "', reason='" + i_to_str(reason) + "', desc='" + desc + "');\n";
    err = gpgme_op_edit (ctx, key, edit_fnc_revoke_item, out, out);
    if (err != GPG_ERR_NO_ERROR)
        return get_error_map(__func__, gpgme_err_code (err), gpgme_strerror (err), __LINE__, __FILE__);


    key_index = "";
    reason_index = "";
    current_uid = "";

    gpgme_data_release (out);
    gpgme_key_unref (key);
    gpgme_release (ctx);

    response["error"] = false;
    response["edit_status"] = edit_status;
    response["result"] = "Item Revoked";

    return response;
}

Here is the call graph for this function:

 All Classes Functions