Subsections


Certificate manipulation functions

The following function allows querying and manipulation of certificates, provided that a storage is already open and the certificate to be manipulated is already known, either by its ID or by a X.509 structure.

If you need to search for a certificate inside the storage, go for Section 4. If you want to exchange certificates with the outside world (import/export), go for Section 5.

CST_delete_cert

int CST_delete_cert (CST * st, const cst_t_seqnum certID)

Delete certificate
Parameters

Returns

Errors

CST_append_X509

int CST_append_X509 (CST * st, X509 * cert)

Append X509 certificate to storage
Parameters

Returns

Errors

CST_append_sk_X509

GSList* CST_append_sk_X509 (CST * st, CST_STACK_OF_X509 * list)

Append STACK_OF(X509) to storage
Parameters

Returns

Errors (in GSList elements)

CST_get_chain

CST_STACK_OF_X509* CST_get_chain (CST * st, X509 * cert)

Get cert chain for given certificate
Parameters

Returns

Errors

CST_get_chain_id_by_id

GSList* CST_get_chain_id_by_id (CST * st, const cst_t_seqnum certID)

Get cert chain for given certificate ID
Parameters

Returns

Errors

CST_get_chain_id

GSList* CST_get_chain_id (CST * st, X509 * x)

Get certificate chain for a given certificate ID
Parameters

Returns

Errors

CST_get_issued_by_dn

X509_NAME* CST_get_issued_by_dn (X509 * cert)

Get issuer distinguished name (issued by)
Parameters

Returns

CST_get_subject_dn

X509_NAME* CST_get_subject_dn (X509 * cert)

Get subject distinguished name (issued to)
Parameters

Returns

CST_is_expired

int CST_is_expired (X509 * cert)

Returns expiration status of a certificate
Parameters

Returns

CST_get_serial_number

ASN1_INTEGER* CST_get_serial_number (X509 * cert)

Get serial number
Parameters

Returns

CST_get_serial_number_t

char* CST_get_serial_number_t (X509 * cert)

Get serial number in string
Parameters

Returns

CST_get_fingerprint

char* CST_get_fingerprint (X509 * cert)

Get fingerprint. In Maemo SDK 1.2, MD5 is the default fingerprint hash for this function.
Parameters

Returns

CST_get_fingerprint_MD5

char* CST_get_fingerprint_MD5 (X509 * cert)

Get fingerprint hashed by MD5
Parameters

Returns

CST_get_fingerprint_SHA1

char* CST_get_fingerprint_SHA1 (X509 * cert)

Get fingerprint hashed by SHA1
Parameters

Returns

CST_get_email

char* CST_get_email (X509 * cert)

Get email if exist or NULL
Parameters

Returns

CST_get_domain_name

char* CST_get_domain_name (X509 * cert)

Get domain name if exist or NULL
Parameters

Returns

CST_get_public_key_alg

char* CST_get_public_key_alg (X509 * cert)

Get public key algorithm
Parameters

Returns

CST_check_purpose_x

int CST_check_purpose_x (X509 * x, const cst_t_cert_purpose purposes)

Check purpose of X.509 certificate.
Parameters

Returns

CST_check_purpose

int CST_check_purpose (CST * st, const cst_t_seqnum certID, const cst_t_cert_purpose purpose)

Check purpose of certificate in storage by his storage ID.
Parameters

Returns

Errors

CST_is_root

int CST_is_root (X509 * cert)

Check that certificate is root
Parameters

Returns

CST_is_root_id

int CST_is_root_id (CST * st, const cst_t_seqnum certID)

Check that certificate (certID) is root
Parameters

Returns

CST_is_CA

int CST_is_CA (X509 * cert)

Check that certificate can be a Certificate Authority (CA)
Parameters

Returns

CST_is_revoked

int CST_is_revoked (CST * st, X509 * cert)

Get revoked state
Parameters

Returns

Errors

CST_is_network

int CST_is_network (CST * st, X509 * cert)

Get stored on network state. WARNING: still not implemented.
Parameters

Returns

Errors

CST_get_network_URL

char* CST_get_network_URL (CST * st, X509 * cert)

Get stored on network URL. WARNING: still not implemented.
Parameters

Returns

Errors

CST_set_folder

int CST_set_folder (CST * st, const cst_t_seqnum certID, const cst_t_cert_folder f)

Set the certificate folder
Parameters

Returns

Errors

CST_get_folder

cst_t_cert_folder CST_get_folder (CST * st, const cst_t_seqnum certID)

Get certificate folder
Parameters

Returns

Errors

CST_set_purpose

int CST_set_purpose (CST * st, const cst_t_seqnum certID, const cst_t_cert_purpose p, const int value)

Set purpose (trust settings) for a certificate.
Parameters

Returns

Errors

CST_is_purpose

int CST_is_purpose (CST * st, const cst_t_seqnum certID, const cst_t_cert_purpose p)

Check purpose (trust) of a given certificate.
Parameters

Returns

Errors

CST_is_valid

int CST_is_valid (CST * st, X509 * cert)

Check certificate validity. WARNING: present implementation does NOT check trust chain, so any non-corrupt certificate will be considered valid. In next versions, this behavior may change: only trusted certificates may be considered valid, and a self-signed certificate that is not itself a trusted CA will be considered invalid.
Parameters

Returns

Errors

CST_is_valid_f

int CST_is_valid_f (CST * st, FILE * file, GError ** error)

Check certificate validity, reading the certificate from a PEM-format file. WARNING: present implementation does NOT check trust chain, so any non-corrupt certificate will be considered valid. In next versions, this behavior may change: only trusted certificates may be considered valid, and a self-signed certificate that is not itself a trusted CA will be considered invalid.
Parameters

Returns

Errors

CST_is_valid_f_DER

int CST_is_valid_f_DER (CST * st, FILE * file, GError ** error)

Check certificate of a certificate inside a DER-format file. WARNING: present implementation does NOT check trust chain, so any non-corrupt certificate will be considered valid. In next versions, this behavior may change: only trusted certificates may be considered valid, and a self-signed certificate that is not itself a trusted CA will be considered invalid.
Parameters

Returns

Errors

CST_is_valid_for

int CST_is_valid_for (CST * st, X509 * cert, const cst_t_cert_purpose purpose)

Check certificate validity for a set of purposes.
Parameters

Returns

Errors

CST_get_state

int CST_get_state (CST * st, X509 * cert)

Get state of certificate (valid, invalid etc.).
Parameters

Returns

Errors

CST_get_cert

X509* CST_get_cert (CST * st, const cst_t_seqnum certID)

Get X509 by certID
Parameters

Returns

Errors

CST_get_valid_from

time_t CST_get_valid_from(X509 * cert)

Gets the date/time that certificate begins to be valid.
Parameters

Returns

CST_get_valid_to

time_t CST_get_valid_to(X509 * cert)

Gets the certification expiration date/time.
Parameters

Returns

Elvis Pfutzenreuter 2006-02-17