Find Key
[Keys and Keyrings]


Functions

const ops_keydata_tops_keyring_get_key_by_index (const ops_keyring_t *keyring, int index)
 Returns key inside a keyring, chosen by index.
const ops_keydata_tops_keyring_find_key_by_id (const ops_keyring_t *keyring, const unsigned char keyid[OPS_KEY_ID_SIZE])
 Finds key in keyring from its Key ID.
const ops_keydata_tops_keyring_find_key_by_userid (const ops_keyring_t *keyring, const char *userid)
 Finds key from its User ID.

Function Documentation

const ops_keydata_t* ops_keyring_find_key_by_id const ops_keyring_t keyring,
const unsigned char  keyid[OPS_KEY_ID_SIZE]
 

Finds key in keyring from its Key ID.

Parameters:
keyring Keyring to be searched
keyid ID of required key
Returns:
Pointer to key, if found; NULL, if not found
Note:
This returns a pointer to the key inside the given keyring, not a copy. Do not free it after use.
Example code:
   void example(ops_keyring_t* keyring)
   {
   ops_keydata_t* keydata=NULL;
   unsigned char keyid[OPS_KEY_ID_SIZE]; // value set elsewhere
   keydata=ops_keyring_find_key_by_id(keyring,keyid);
   ...
   }

const ops_keydata_t* ops_keyring_find_key_by_userid const ops_keyring_t keyring,
const char *  userid
 

Finds key from its User ID.

Parameters:
keyring Keyring to be searched
userid User ID of required key
Returns:
Pointer to Key, if found; NULL, if not found
Note:
This returns a pointer to the key inside the keyring, not a copy. Do not free it.
Example code:
   void example(ops_keyring_t* keyring)
   {
   ops_keydata_t* keydata=NULL;
   keydata=ops_keyring_find_key_by_userid(keyring,"user@domain.com");
   ...
   }

const ops_keydata_t* ops_keyring_get_key_by_index const ops_keyring_t keyring,
int  index
 

Returns key inside a keyring, chosen by index.

Parameters:
keyring Pointer to existing keyring
index Index of required key
Note:
Index starts at 0

This returns a pointer to the original key, not a copy. You do not need to free the key after use.

Returns:
Pointer to the required key; or NULL if index too large.
Example code:
    void example(const ops_keyring_t* keyring)
    {
    ops_keydata_t* keydata=NULL;
    keydata=ops_keyring_get_key_by_index(keyring, 0);
    ...
    }


Generated on Sat May 18 00:00:02 2013 for OpenPGP:SDK by  doxygen 1.4.6