Function silc_skr_add_public_key
SYNOPSIS
SilcSKRStatus silc_skr_add_public_key(SilcSKR skr,
SilcPublicKey public_key,
SilcSKRKeyUsage usage,
void *key_context,
SilcSKRKey *return_key);
DESCRIPTION
Add a public key to repository. The repository will steal `public_key'
and caller must not free it. The `key_context' is optional key specific
context that will be saved in the repository with the key, and can be
retrieved with the key. Public key can be added only once to the
repository. To add same key more than once to repository different
`key_context' must be used each time.
Returns an entry of the added public key in the repository to the
`return_key' pointer, if it is non-NULL. The returned entry remains
valid as long as the public key is in the repository, however a
reference may be taken with silc_skr_ref_public_key to assure the
entry remains valid.
Returns SILC_SKR_OK if the key was added successfully, and error
status if key could not be added, or has been added already.
EXAMPLE
// Add a key to repository
if (silc_skr_add_public_key(repository, pubkey, SILC_SKR_USAGE_ANY,
NULL, NULL) != SILC_SKR_OK)
goto error;
|