Subsections
These functions allow to store and retrieve keys that are not related
to any certificate. They manipulate in-memory keys; in order to import
and export such keys, refer to Section 5.
int CST_append_priv_key (CST * st, X509_NAME * account,
EVP_PKEY * key, unsigned char * password)
Append private key to storage
Parameters
- st Pointer to storage structure
- account Distinguished name for identify key
- key Pointer to private key
- password Password for key in storage
Returns
Errors
- CST_ERROR_PARAM_INCORRECT (if storage is NULL)
- CST_ERROR_DBSTRUCTURE_CORRUPT
- CST_ERROR_IO
- CST_ERROR_NOSPC
int CST_append_pub_key (CST * st, X509_NAME * account,
EVP_PKEY * key)
Append public key to storage
Parameters
- st Pointer to storage structure
- account Distinguished name for identify key
- key Pointer to public key
Returns
Errors
- CST_ERROR_PARAM_INCORRECT (if storage is NULL)
- CST_ERROR_DBSTRUCTURE_CORRUPT
- CST_ERROR_IO
- CST_ERROR_NOSPC
X509_NAME* CST_get_key_account (CST * st, cst_t_seqnum
keyID)
Get account assigned with key
Parameters
- st Pointer to storage structure
- keyID Key ID
Returns
- Account assigned with key on append or import . User is responsible
to free this object using X509_NAME_free().
Errors
- CST_ERROR_PARAM_INCORRECT (if storage is NULL)
- CST_ERROR_KEY_NOTFOUND - if account not found
int CST_delete_all_pub_key (CST * st, X509_NAME * account)
Delete all public key for account
Parameters
- st Pointer to storage structure
- account Key for identify key
Returns
Errors
- CST_ERROR_PARAM_INCORRECT (if storage is NULL)
- CST_ERROR_KEY_NOTFOUND - if account not found
int CST_delete_all_priv_key (CST * st, X509_NAME *
account)
Delete all private key for account
Parameters
- st Pointer to storage structure
- account Key for identify key
Returns
Errors
- CST_ERROR_PARAM_INCORRECT (if storage is NULL)
- CST_ERROR_KEY_NOTFOUND - if account not found
int CST_delete_pub_key (CST * st, const cst_t_seqnum
keyID)
Delete public key form storage
Parameters
- st Pointer to storage structure
- keyID Public key ID
Returns
Errors
- CST_ERROR_PARAM_INCORRECT (if storage is NULL)
- CST_ERROR_KEY_NOTFOUND
int CST_delete_priv_key (CST * st, const cst_t_seqnum
keyID)
Delete private key form storage
Parameters
- st Pointer to storage structure
- keyID Private key ID
Returns
Errors
- CST_ERROR_PARAM_INCORRECT (if storage is NULL)
- CST_ERROR_KEY_NOTFOUND
GSList* CST_priv_key_search_by_name (CST * st, X509_NAME
* account)
Get all private keys for a given account.
Parameters
- st Pointer to storage structure
- account Account
Returns
- Array of storage IDs of keys. User is responsible to free this object
using g_slist_free().
- NULL if chain not found
Errors
- CST_ERROR_PARAM_INCORRECT (if storage is NULL)
- CST_ERROR_KEY_NOTFOUND - if cert chain incomplete
GSList* CST_pub_key_search_by_name (CST * st, X509_NAME
* account)
Get all public keys for a given account.
Parameters
- st Pointer to storage structure
- account Account
Returns
- Array of keys' storage IDs. User is responsible to free this object
using g_slist_free().
- NULL if chain not found
Errors
- CST_ERROR_PARAM_INCORRECT (if storage is NULL)
- CST_ERROR_KEY_NOTFOUND - if cert chain incomplete
char* CST_EVP_PKEY_to_text (EVP_PKEY * key)
Convert key to human-readable text format
Parameters
- key the key to be converted.
Returns
- Key in human-readable string. User is responsible to free this object
using g_free().
- NULL if some error occured (no error is set).
EVP_PKEY* CST_get_key (CST * st, const cst_t_seqnum
keyID, unsigned char * password)
Get private key by storage ID.
Parameters
- st Pointer to storage structure
- keyID Private key ID
- password the password to recover the key
Returns
- Private key. User is responsible to free this object using EVP_PKEY_free().
- NULL if error.
Errors
- CST_ERROR_PARAM_INCORRECT (if storage is NULL)
- CST_ERROR_KEY_NOTFOUND
- CST_ERROR_PASSWORD_WRONG
EVP_PKEY* CST_get_pub_key (CST * st, const cst_t_seqnum
keyID)
Get public key EVP_PKEY by keyID
Parameters
- st Pointer to storage structure
- keyID Public key ID
Returns
- Public key. User is responsible to free this object using EVP_PKEY_free()
- NULL if error.
Errors
- CST_ERROR_PARAM_INCORRECT (if storage is NULL)
- CST_ERROR_KEY_NOTFOUND
Elvis Pfutzenreuter
2006-02-17