GMimeCertificate

## GMimeCertificate GMimeCertificate — Digital certificates |

## Synopsis

    enum                GMimePubKeyAlgo;
    enum                GMimeDigestAlgo;
    enum                GMimeCertificateTrust;
                        GMimeCertificate;
    GMimeCertificate *  g_mime_certificate_new              (void);
    GMimePubKeyAlgo     g_mime_certificate_get_pubkey_algo  (GMimeCertificate *cert);
    void                g_mime_certificate_set_pubkey_algo  (GMimeCertificate *cert,
                                                             GMimePubKeyAlgo algo);
    GMimeDigestAlgo     g_mime_certificate_get_digest_algo  (GMimeCertificate *cert);
    void                g_mime_certificate_set_digest_algo  (GMimeCertificate *cert,
                                                             GMimeDigestAlgo algo);
    const char *        g_mime_certificate_get_issuer_serial
                                                            (GMimeCertificate *cert);
    void                g_mime_certificate_set_issuer_serial
                                                            (GMimeCertificate *cert,
                                                             const char *issuer_serial);
    const char *        g_mime_certificate_get_issuer_name  (GMimeCertificate *cert);
    void                g_mime_certificate_set_issuer_name  (GMimeCertificate *cert,
                                                             const char *issuer_name);
    const char *        g_mime_certificate_get_fingerprint  (GMimeCertificate *cert);
    void                g_mime_certificate_set_fingerprint  (GMimeCertificate *cert,
                                                             const char *fingerprint);
    time_t              g_mime_certificate_get_created      (GMimeCertificate *cert);
    void                g_mime_certificate_set_created      (GMimeCertificate *cert,
                                                             time_t created);
    time_t              g_mime_certificate_get_expires      (GMimeCertificate *cert);
    void                g_mime_certificate_set_expires      (GMimeCertificate *cert,
                                                             time_t expires);
    const char *        g_mime_certificate_get_key_id       (GMimeCertificate *cert);
    void                g_mime_certificate_set_key_id       (GMimeCertificate *cert,
                                                             const char *key_id);
    GMimeCertificateTrust  g_mime_certificate_get_trust     (GMimeCertificate *cert);
    void                g_mime_certificate_set_trust        (GMimeCertificate *cert,
                                                             GMimeCertificateTrust trust);
    const char *        g_mime_certificate_get_email        (GMimeCertificate *cert);
    void                g_mime_certificate_set_email        (GMimeCertificate *cert,
                                                             const char *email);
    const char *        g_mime_certificate_get_name         (GMimeCertificate *cert);
    void                g_mime_certificate_set_name         (GMimeCertificate *cert,
                                                             const char *name);

                        GMimeCertificateList;
    GMimeCertificateList * g_mime_certificate_list_new      (void);
    int                 g_mime_certificate_list_length      (GMimeCertificateList *list);
    void                g_mime_certificate_list_clear       (GMimeCertificateList *list);
    int                 g_mime_certificate_list_add         (GMimeCertificateList *list,
                                                             GMimeCertificate *cert);
    void                g_mime_certificate_list_insert      (GMimeCertificateList *list,
                                                             int index,
                                                             GMimeCertificate *cert);
    gboolean            g_mime_certificate_list_remove      (GMimeCertificateList *list,
                                                             GMimeCertificate *cert);
    gboolean            g_mime_certificate_list_remove_at   (GMimeCertificateList *list,
                                                             int index);
    gboolean            g_mime_certificate_list_contains    (GMimeCertificateList *list,
                                                             GMimeCertificate *cert);
    int                 g_mime_certificate_list_index_of    (GMimeCertificateList *list,
                                                             GMimeCertificate *cert);
    GMimeCertificate *  g_mime_certificate_list_get_certificate
                                                            (GMimeCertificateList *list,
                                                             int index);
    void                g_mime_certificate_list_set_certificate
                                                            (GMimeCertificateList *list,
                                                             int index,
                                                             GMimeCertificate *cert);

## Object Hierarchy

      GObject
       +----GMimeCertificate

      GObject
       +----GMimeCertificateList

## Description

A GMimeCertificate is an object containing useful information about a digital certificate as used in signing and encrypting data.

## Details

### enum GMimePubKeyAlgo

    typedef enum {
    	GMIME_PUBKEY_ALGO_DEFAULT  = 0,
    	GMIME_PUBKEY_ALGO_RSA      = 1,
    	GMIME_PUBKEY_ALGO_RSA_E    = 2,
    	GMIME_PUBKEY_ALGO_RSA_S    = 3,
    	GMIME_PUBKEY_ALGO_ELG_E    = 16,
    	GMIME_PUBKEY_ALGO_DSA      = 17,
    	GMIME_PUBKEY_ALGO_ELG      = 20
    } GMimePubKeyAlgo;

A public-key algorithm.

`GMIME_PUBKEY_ALGO_DEFAULT` | The default public-key algorithm.
`GMIME_PUBKEY_ALGO_RSA` | The RSA algorithm.
`GMIME_PUBKEY_ALGO_RSA_E` | An encryption-only RSA algorithm.
`GMIME_PUBKEY_ALGO_RSA_S` | A signature-only RSA algorithm.
`GMIME_PUBKEY_ALGO_ELG_E` | An encryption-only ElGamal algorithm.
`GMIME_PUBKEY_ALGO_DSA` | The DSA algorithm.
`GMIME_PUBKEY_ALGO_ELG` | The ElGamal algorithm.

### enum GMimeDigestAlgo

    typedef enum {
    	GMIME_DIGEST_ALGO_DEFAULT     = 0,
    	GMIME_DIGEST_ALGO_MD5         = 1,
    	GMIME_DIGEST_ALGO_SHA1        = 2,
    	GMIME_DIGEST_ALGO_RIPEMD160   = 3,
    	GMIME_DIGEST_ALGO_MD2         = 5,
    	GMIME_DIGEST_ALGO_TIGER192    = 6,
    	GMIME_DIGEST_ALGO_HAVAL5160   = 7,
    	GMIME_DIGEST_ALGO_SHA256      = 8,
    	GMIME_DIGEST_ALGO_SHA384      = 9,
    	GMIME_DIGEST_ALGO_SHA512      = 10,
    	GMIME_DIGEST_ALGO_SHA224      = 11,
    	GMIME_DIGEST_ALGO_MD4         = 301,
    } GMimeDigestAlgo;

A hash algorithm.

`GMIME_DIGEST_ALGO_DEFAULT` | The default hash algorithm.
`GMIME_DIGEST_ALGO_MD5` | The MD5 hash algorithm.
`GMIME_DIGEST_ALGO_SHA1` | The SHA-1 hash algorithm.
`GMIME_DIGEST_ALGO_RIPEMD160` | The RIPEMD-160 hash algorithm.
`GMIME_DIGEST_ALGO_MD2` | The MD2 hash algorithm.
`GMIME_DIGEST_ALGO_TIGER192` | The TIGER-192 hash algorithm.
`GMIME_DIGEST_ALGO_HAVAL5160` | The HAVAL-5-160 hash algorithm.
`GMIME_DIGEST_ALGO_SHA256` | The SHA-256 hash algorithm.
`GMIME_DIGEST_ALGO_SHA384` | The SHA-384 hash algorithm.
`GMIME_DIGEST_ALGO_SHA512` | The SHA-512 hash algorithm.
`GMIME_DIGEST_ALGO_SHA224` | The SHA-224 hash algorithm.
`GMIME_DIGEST_ALGO_MD4` | The MD4 hash algorithm.

### enum GMimeCertificateTrust

    typedef enum {
    	GMIME_CERTIFICATE_TRUST_NONE,
    	GMIME_CERTIFICATE_TRUST_NEVER,
    	GMIME_CERTIFICATE_TRUST_UNDEFINED,
    	GMIME_CERTIFICATE_TRUST_MARGINAL,
    	GMIME_CERTIFICATE_TRUST_FULLY,
    	GMIME_CERTIFICATE_TRUST_ULTIMATE
    } GMimeCertificateTrust;

The trust value of a certificate.

`GMIME_CERTIFICATE_TRUST_NONE` | No trust assigned.
`GMIME_CERTIFICATE_TRUST_NEVER` | Never trust this certificate.
`GMIME_CERTIFICATE_TRUST_UNDEFINED` | Undefined trust for this certificate.
`GMIME_CERTIFICATE_TRUST_MARGINAL` | Trust this certificate maginally.
`GMIME_CERTIFICATE_TRUST_FULLY` | Trust this certificate fully.
`GMIME_CERTIFICATE_TRUST_ULTIMATE` | Trust this certificate ultimately.

### GMimeCertificate

    typedef struct _GMimeCertificate GMimeCertificate;

An object containing useful information about a certificate.

### g_mime_certificate_new ()

    GMimeCertificate *  g_mime_certificate_new              (void);

Creates a new GMimeCertificate object.

Returns : | a new GMimeCertificate object.

### g_mime_certificate_get_pubkey_algo ()

    GMimePubKeyAlgo     g_mime_certificate_get_pubkey_algo  (GMimeCertificate *cert);

Get the public-key algorithm used by the certificate.

`cert` : | a GMimeCertificate
Returns : | the public-key algorithm used by the certificate or GMIME_PUBKEY_ALGO_DEFAULT if unspecified.

### g_mime_certificate_set_pubkey_algo ()

    void                g_mime_certificate_set_pubkey_algo  (GMimeCertificate *cert,
                                                             GMimePubKeyAlgo algo);

Set the public-key algorithm used by the certificate.

`cert` : | a GMimeCertificate
`algo` : | a GMimePubKeyAlgo

### g_mime_certificate_get_digest_algo ()

    GMimeDigestAlgo     g_mime_certificate_get_digest_algo  (GMimeCertificate *cert);

Get the digest algorithm used by the certificate.

`cert` : | a GMimeCertificate
Returns : | the digest algorithm used by the certificate or GMIME_DIGEST_ALGO_DEFAULT if unspecified.

### g_mime_certificate_set_digest_algo ()

    void                g_mime_certificate_set_digest_algo  (GMimeCertificate *cert,
                                                             GMimeDigestAlgo algo);

Set the digest algorithm used by the certificate.

`cert` : | a GMimeCertificate
`algo` : | a GMimeDigestAlgo

### g_mime_certificate_get_issuer_serial ()

    const char *        g_mime_certificate_get_issuer_serial
                                                            (GMimeCertificate *cert);

Get the certificate's issuer serial.

`cert` : | a GMimeCertificate
Returns : | the certificate's issuer serial or `NULL` if unspecified.

### g_mime_certificate_set_issuer_serial ()

    void                g_mime_certificate_set_issuer_serial
                                                            (GMimeCertificate *cert,
                                                             const char *issuer_serial);

Set the certificate's issuer serial.

`cert` : | a GMimeCertificate
`issuer_serial` : | certificate's issuer serial

### g_mime_certificate_get_issuer_name ()

    const char *        g_mime_certificate_get_issuer_name  (GMimeCertificate *cert);

Get the certificate's issuer name.

`cert` : | a GMimeCertificate
Returns : | the certificate's issuer name or `NULL` if unspecified.

### g_mime_certificate_set_issuer_name ()

    void                g_mime_certificate_set_issuer_name  (GMimeCertificate *cert,
                                                             const char *issuer_name);

Set the certificate's issuer name.

`cert` : | a GMimeCertificate
`issuer_name` : | certificate's issuer name

### g_mime_certificate_get_fingerprint ()

    const char *        g_mime_certificate_get_fingerprint  (GMimeCertificate *cert);

Get the certificate's key fingerprint.

`cert` : | a GMimeCertificate
Returns : | the certificate's key fingerprint or `NULL` if unspecified.

### g_mime_certificate_set_fingerprint ()

    void                g_mime_certificate_set_fingerprint  (GMimeCertificate *cert,
                                                             const char *fingerprint);

Set the certificate's key fingerprint.

`cert` : | a GMimeCertificate
`fingerprint` : | fingerprint string

### g_mime_certificate_get_created ()

    time_t              g_mime_certificate_get_created      (GMimeCertificate *cert);

Get the creation date of the certificate's key.

`cert` : | a GMimeCertificate
Returns : | the creation date of the certificate's key or `-1` if unknown.

### g_mime_certificate_set_created ()

    void                g_mime_certificate_set_created      (GMimeCertificate *cert,
                                                             time_t created);

Set the creation date of the certificate's key.

`cert` : | a GMimeCertificate
`created` : | creation date

### g_mime_certificate_get_expires ()

    time_t              g_mime_certificate_get_expires      (GMimeCertificate *cert);

Get the expiration date of the certificate's key.

`cert` : | a GMimeCertificate
Returns : | the expiration date of the certificate's key or `-1` if unknown.

### g_mime_certificate_set_expires ()

    void                g_mime_certificate_set_expires      (GMimeCertificate *cert,
                                                             time_t expires);

Set the expiration date of the certificate's key.

`cert` : | a GMimeCertificate
`expires` : | expiration date

### g_mime_certificate_get_key_id ()

    const char *        g_mime_certificate_get_key_id       (GMimeCertificate *cert);

Get the certificate's key id.

`cert` : | a GMimeCertificate
Returns : | the certificate's key id or `NULL` if unspecified.

### g_mime_certificate_set_key_id ()

    void                g_mime_certificate_set_key_id       (GMimeCertificate *cert,
                                                             const char *key_id);

Set the certificate's key id.

`cert` : | a GMimeCertificate
`key_id` : | key id

### g_mime_certificate_get_trust ()

    GMimeCertificateTrust  g_mime_certificate_get_trust     (GMimeCertificate *cert);

Get the certificate trust.

`cert` : | a GMimeCertificate
Returns : | the certificate trust.

### g_mime_certificate_set_trust ()

    void                g_mime_certificate_set_trust        (GMimeCertificate *cert,
                                                             GMimeCertificateTrust trust);

Set the certificate trust.

`cert` : | a GMimeCertificate
`trust` : | a GMimeCertificateTrust value

### g_mime_certificate_get_email ()

    const char *        g_mime_certificate_get_email        (GMimeCertificate *cert);

Get the certificate's email.

`cert` : | a GMimeCertificate
Returns : | the certificate's email or `NULL` if unspecified.

### g_mime_certificate_set_email ()

    void                g_mime_certificate_set_email        (GMimeCertificate *cert,
                                                             const char *email);

Set the certificate's email.

`cert` : | a GMimeCertificate
`email` : | certificate's email

### g_mime_certificate_get_name ()

    const char *        g_mime_certificate_get_name         (GMimeCertificate *cert);

Get the certificate's name.

`cert` : | a GMimeCertificate
Returns : | the certificate's name or `NULL` if unspecified.

### g_mime_certificate_set_name ()

    void                g_mime_certificate_set_name         (GMimeCertificate *cert,
                                                             const char *name);

Set the certificate's name.

`cert` : | a GMimeCertificate
`name` : | certificate's name

### GMimeCertificateList

    typedef struct _GMimeCertificateList GMimeCertificateList;

A collection of GMimeCertificate objects.

### g_mime_certificate_list_new ()

    GMimeCertificateList * g_mime_certificate_list_new      (void);

Creates a new GMimeCertificateList.

Returns : | a new GMimeCertificateList.

### g_mime_certificate_list_length ()

    int                 g_mime_certificate_list_length      (GMimeCertificateList *list);

Gets the length of the list.

`list` : | a GMimeCertificateList
Returns : | the number of GMimeCertificate objects in the list.

### g_mime_certificate_list_clear ()

    void                g_mime_certificate_list_clear       (GMimeCertificateList *list);

Clears the list of addresses.

`list` : | a GMimeCertificateList

### g_mime_certificate_list_add ()

    int                 g_mime_certificate_list_add         (GMimeCertificateList *list,
                                                             GMimeCertificate *cert);

Adds a GMimeCertificate to the GMimeCertificateList.

`list` : | a GMimeCertificateList
`cert` : | a GMimeCertificate
Returns : | the index of the added GMimeCertificate.

### g_mime_certificate_list_insert ()

    void                g_mime_certificate_list_insert      (GMimeCertificateList *list,
                                                             int index,
                                                             GMimeCertificate *cert);

Inserts a GMimeCertificate into the GMimeCertificateList at the specified index.

`list` : | a GMimeCertificateList
`index` : | index to insert at
`cert` : | a GMimeCertificate

### g_mime_certificate_list_remove ()

    gboolean            g_mime_certificate_list_remove      (GMimeCertificateList *list,
                                                             GMimeCertificate *cert);

Removes a GMimeCertificate from the GMimeCertificateList.

`list` : | a GMimeCertificateList
`cert` : | a GMimeCertificate
Returns : | `TRUE` if the specified GMimeCertificate was removed or `FALSE` otherwise.

### g_mime_certificate_list_remove_at ()

    gboolean            g_mime_certificate_list_remove_at   (GMimeCertificateList *list,
                                                             int index);

Removes a GMimeCertificate from the GMimeCertificateList at the specified index.

`list` : | a GMimeCertificateList
`index` : | index to remove
Returns : | `TRUE` if an GMimeCertificate was removed or `FALSE` otherwise.

### g_mime_certificate_list_contains ()

    gboolean            g_mime_certificate_list_contains    (GMimeCertificateList *list,
                                                             GMimeCertificate *cert);

Checks whether or not the specified GMimeCertificate is contained within the GMimeCertificateList.

`list` : | a GMimeCertificateList
`cert` : | a GMimeCertificate
Returns : | `TRUE` if the specified GMimeCertificate is contained within the specified GMimeCertificateList or `FALSE` otherwise.

### g_mime_certificate_list_index_of ()

    int                 g_mime_certificate_list_index_of    (GMimeCertificateList *list,
                                                             GMimeCertificate *cert);

Gets the index of the specified GMimeCertificate inside the GMimeCertificateList.

`list` : | a GMimeCertificateList
`cert` : | a GMimeCertificate
Returns : | the index of the requested GMimeCertificate within the GMimeCertificateList or `-1` if it is not contained within the GMimeCertificateList.

### g_mime_certificate_list_get_certificate ()

    GMimeCertificate *  g_mime_certificate_list_get_certificate
                                                            (GMimeCertificateList *list,
                                                             int index);

Gets the GMimeCertificate at the specified index.

`list` : | a GMimeCertificateList
`index` : | index of GMimeCertificate to get
Returns : | the GMimeCertificate at the specified index or `NULL` if the index is out of range.

### g_mime_certificate_list_set_certificate ()

    void                g_mime_certificate_list_set_certificate
                                                            (GMimeCertificateList *list,
                                                             int index,
                                                             GMimeCertificate *cert);

Sets the GMimeCertificate at the specified index to `cert`.

`list` : | a GMimeCertificateList
`index` : | index of GMimeCertificate to set
`cert` : | a GMimeCertificate