Subsections
These functions allow to manipulate particular keys of a certificate.
int CST_set_default (CST * st, const cst_t_seqnum certID)
Set default certificate for the certificate's e-mail.
Parameters
- st Pointer to storage structure
- certID Certificate ID
Returns
Errors
- CST_ERROR_PARAM_INCORRECT (if storage or crlID is NULL)
- CST_ERROR_NOT_FOUND
X509* CST_default_cert (CST * st, const char * email)
Get default certificate for an e-mail
Parameters
- st Pointer to storage structure
- email Email to be searched for
Returns
- Default certificate for the supplied e-mail. User is responsible to
free this object using X509_free().
- NULL if no certificate is marked default
Errors
- CST_ERROR_PARAM_INCORRECT (if storage is NULL)
- CST_ERROR_CERT_NOTFOUND
cst_t_seqnum CST_default_cert_id (CST * st, const char
* email)
Get default certificate ID by email
Parameters
- st Pointer to storage structure
- email Email to be searched for
Returns
- certID of default certificate for the supplied e-mail
Errors
- CST_ERROR_PARAM_INCORRECT (if storage is NULL)
- CST_ERROR_CERT_NOTFOUND
int CST_is_default (CST * st, const cst_t_seqnum certID)
Tests if a certificate is the default for its e-mail contact.
Parameters
- st Pointer to storage structure
- certID Certificate id
Returns
Errors
- CST_ERROR_PARAM_INCORRECT (if storage is NULL)
- CST_ERROR_CERT_NOTFOUND
CST_assign
int CST_assign (CST * st, const cst_t_seqnum certID, const
cst_t_seqnum keyID, unsigned char * password)
Assign private key with certificate. Useful to assign a private key
previously imported by CRT_import_priv_key() (section 5.14)
to a certificate.
Parameters
- st Storage structure
- certID Certificate storage ID
- keyID Private key storage ID
- password Password, need for test correct assign
Returns
Errors
- CST_ERROR_ASSIGN_INCORRECT
EVP_PKEY* CST_get_priv_key_by_UID (CST * st, X509_NAME
* issuer, ASN1_INTEGER * serial, unsigned char * password)
Get private key by certificate UID
Parameters
- st Pointer to storage structure
- issuer Distinguished name of issuer
- serial Serial number
- password Password
Returns
- Private key. User is responsible to free this object using EVP_PKEY_free().
- NULL if not found
Errors
- CST_ERROR_PARAM_INCORRECT (if storage is NULL)
- CST_ERROR_CERT_NOTFOUND
- CST_ERROR_KEY_NOTFOUND
- CST_ERROR_PASSWORD_WRONG
EVP_PKEY* CST_get_priv_key (CST * st, X509 * cert,
unsigned char * password)
Get private key by certificate
Parameters
- st Pointer to storage structure
- cert Pointer to cert
- password Password
Returns
- Private key. User is responsible to free this object using EVP_PKEY_free().
- NULL if not found
Errors
- CST_ERROR_PARAM_INCORRECT (if storage is NULL)
- CST_ERROR_CERT_NOTFOUND
- CST_ERROR_KEY_NOTFOUND
- CST_ERROR_PASSWORD_WRONG
cst_t_seqnum CST_get_assigned_key (CST * st, const cst_t_seqnum
certID)
Get private key ID by its certificate ID
Parameters
- st Pointer to storage structure
- certID certID
Returns
- Private key storage ID
- 0 if not found
Errors
- CST_ERROR_PARAM_INCORRECT (if storage is NULL)
- CST_ERROR_CERT_NOTFOUND
EVP_PKEY* CST_get_priv_key_default (CST * st, char
* email, unsigned char * password)
Get private key for default certificate
Parameters
- st Pointer to storage structure
- email Email
- password Password
Returns
- Private key. User is responsible to free this object using EVP_PKEY_free().
- NULL if not found
Errors
- CST_ERROR_PARAM_INCORRECT (if storage is NULL)
- CST_ERROR_CERT_NOTFOUND
- CST_ERROR_KEY_NOTFOUND
- CST_ERROR_PASSWORD_WRONG
Elvis Pfutzenreuter
2006-02-17