Skip to content
kylehuff edited this page Sep 25, 2011 · 1 revision

getKeyList(const std::string& name, int secret_only)

###Method Type: Private This method retrieves all keys matching <name>, or if name is left empty, returns all keys in the keyring Keyring selection is based on the <secret_only>, if not null||<1, the secret keyring is used.

getPublicKeyList()

###Method Type: Public This method executes getKeyList with an empty string and secret_only=0 which returns all Public Keys in the keyring.

getPrivateKeyList()

###Method Type: Public This method executes getKeyList with an empty string and secret_only=1 which returns all keys in the keyring which the user has the corrisponding secret key.

getNamedKey(const std::string& name)

###Method Type: Public This method calls getKeyList with a <name> as the <getKeyList name> parameter, and <getKeyList secret_onl\y> as 0 (only public keys). String <name> can be UID, Email, KeyID or key fingerprint.

##gpgEncrypt(const std::string& data, const std::string& enc_to_keyid, const std::string& enc_from_keyid, const std::string& sign) ###Method Type: Public This method passes a string to encrypt, a key to encrypt to and an optional key to encrypt from and calls gpgEncrypt. This method returns a string of the encrypted data. This method accepts 4 parameters: <data>, <enc_to_keyid>, <enc_from_keyid [optional]>, and <sign [optional; default: 0:NULL:false]>

##gpgDecryptVerify(const std::string& data, int use_agent) ###Method Type: Public This method attempts to decrypt and verify the string <data>. If <use_agent> is 0, it will attempt to disable the key-agent to prevent a passphrase dialog from displaying. This would be useful in cases where it is useful when you want to verify or decrypt without unlocking the private keyring (i.e. in an automated parsing environment)

##gpgSignText(const FB::VariantList& signers, const std::string& plain_text, int sign_mode) ###Method Type: Public This method signs the data plain_text with the keys found in signers, using the mode specified in sign_mode. sign_mode is one of:

  • 0: GPGME_SIG_MODE_NORMAL
  • 1: GPGME_SIG_MODE_DETACH
  • 2: GPGME_SIG_MODE_CLEAR

##gpgSignUID(const std::string& keyid, long sign_uid, const std::string& with_keyid, long local_only, long trust_sign, long trust_level) ###Method Type: Public This method signs a given UID on a public or private key.

##gpgDeleteUIDSign(const std::string& keyid, long uid, long signature) ###Method Type: Public Deletes a given signature from the uid on the key specified by keyid

##gpgEnableKey(const std::string& keyid) ###Method Type: Public Enables a given key in either the private or public keyring.

##gpgDisableKey(const std::string& keyid) ###Method Type: Public Disables a given key in either the private or public keyring.

##gpgGenKey(const std::string& key_type, const std::string& key_length, const std::string& subkey_type, const std::string& subkey_length, const std::string& name_real, const std::string& name_comment, const std::string& name_email, const std::string& expire_date, const std::string& passphrase) ###Method Type: Public Generates a key with the given parameters [TODO: Parameters need explanation]

##gpgGenSubKey(const std::string& keyid, const std::string& subkey_type, const std::string& subkey_length, const std::string& subkey_expire, bool sign_flag, bool enc_flag, bool auth_flag) ###Method Type: Public Generates a subkey on key specified by <keyid> with the given parameters [TODO: Parameters need explanation]

##gpgImportKey(const std::string& ascii_key) ###Method Type: Public Imports the key contained in <ascii_key>

##gpgDeleteKey(const std::string& keyid, int allow_secret) ###Method Type: Private Deletes the key matching <keyid>, if <allow_secret> is !(NULL||<1) then the private key is deleted as well

##gpgDeletePublicKey(const std::string& keyid) ###Method Type: Public Deletes the public key specified by <keyid> -- will not delete a private key

##gpgDeletePrivateKey(const std::string& keyid) ###Method Type: Public Deletes the private key specified by <keyid>

##gpgDeletePrivateSubKey(const std::string& keyid, int key_idx) ###Method Type: Public Deletes the sub key at index <key_idx> of the key specified by in <keyid>; Despite the naming convention used, this would delete a subkey from either a public or private key. [TODO: Fix that]

##gpgSetKeyTrust(const std::string& keyid, long trust_level) ###Method Type: Public Sets the Owner Trust for a given <keyid>

##gpgAddUID(const std::string& keyid, const std::string& name, const std::string& email, const std::string& comment) ###Method Type: Public Adds a UID to the key found at <keyid> with the parameters specified [TODO: Explain valid parameters]

##gpgDeleteUID(const std::string& keyid, long uid_idx) ###Method Type: Public Deletes the UID specified by <uid_idx> on the key specified by <keyid>

##gpgSetPrimaryUID(const std::string& keyid, long uid_idx) ###Method Type: Public Sets the UID found at <uid_idx> of the key found with <keyid> as the primary

##gpgSetKeyExpire(const std::string& keyid, long key_idx, long expire) ###Method Type: Public Sets the expiration of a given key found at <keyid> and if <key_idx>. <key_idx> is the subkey to set the expiration of, where 0 is the primary subkey. <expire> is the number of days to expire, or 0 for never expire.

##gpgExportPublicKey(const std::string& keyid) ###Method Type: Public Returns the ASCII encoded public key of the key found with <keyid>

##gpgRevokeItem(const std::string& keyid, const std::string& item, int key_idx, int uid_idx, int sig_idx, int reason, const std::string& desc) ###Method Type: Private This method is called by other more specific public methods to revoke a given "item"

##gpgRevokeKey(const std::string& keyid, int key_idx, int reason, const std::string &desc) ###Method Type: Public Revokes the key found with <keyid>, or the subkey <key_idx> of <keyid> if specified

##gpgRevokeUID(const std::string& keyid, int uid_idx, int reason, const std::string &desc) ###Method Type: Public Revokes the UID <uid_idx> on the key found with <keyid>, with <reason> and revocation description <desc>

##gpgRevokeSignature(const std::string& keyid, int uid_idx, int sig_idx, int reason, const std::string &desc) ###Method Type: Public Revokes the signature <sig_idx> on the key found with <keyid> on UID <uid_idx> with <reason> and revocation description <desc>

##gpgChangePassphrase(const std::string& keyid) ###Method Type: Public Invokes a change-passphrase event on the key found with <keyid> -- you cannot pass the new or existing passphrase to this method, this method just executes the request and expects the gpg-agent to take care of collecting and verifying the original password as well as the new passphrase.

##get_version() ###Method Type: Public Returns the version of webpg-npapi as a string