## CamelCertDB

CamelCertDB

## Synopsis

    enum                CamelCertDBFlags;
    struct              CamelCertDB;
    enum                CamelCertTrust;
                        CamelCert;
    CamelCertDB *       camel_certdb_new                    (void);
    void                camel_certdb_set_default            (CamelCertDB *certdb);
    CamelCertDB *       camel_certdb_get_default            (void);
    void                camel_certdb_set_filename           (CamelCertDB *certdb,
                                                             const gchar *filename);
    gint                camel_certdb_load                   (CamelCertDB *certdb);
    gint                camel_certdb_save                   (CamelCertDB *certdb);
    void                camel_certdb_touch                  (CamelCertDB *certdb);
    CamelCert *         camel_certdb_get_cert               (CamelCertDB *certdb,
                                                             const gchar *fingerprint);
    void                camel_certdb_add                    (CamelCertDB *certdb,
                                                             CamelCert *cert);
    void                camel_certdb_remove                 (CamelCertDB *certdb,
                                                             CamelCert *cert);
    CamelCert *         camel_certdb_cert_new               (CamelCertDB *certdb);
    void                camel_certdb_cert_ref               (CamelCertDB *certdb,
                                                             CamelCert *cert);
    void                camel_certdb_cert_unref             (CamelCertDB *certdb,
                                                             CamelCert *cert);
    void                camel_certdb_clear                  (CamelCertDB *certdb);
    const gchar *       camel_cert_get_string               (CamelCertDB *certdb,
                                                             CamelCert *cert,
                                                             gint string);
    void                camel_cert_set_string               (CamelCertDB *certdb,
                                                             CamelCert *cert,
                                                             gint string,
                                                             const gchar *value);
    #define             camel_cert_get_issuer               (certdb,
                                                             cert)
    #define             camel_cert_get_subject              (certdb,
                                                             cert)
    #define             camel_cert_get_hostname             (certdb,
                                                             cert)
    #define             camel_cert_get_fingerprint          (certdb,
                                                             cert)
    #define             camel_cert_set_issuer               (certdb,
                                                             cert,
                                                             issuer)
    #define             camel_cert_set_subject              (certdb,
                                                             cert,
                                                             subject)
    #define             camel_cert_set_hostname             (certdb,
                                                             cert,
                                                             hostname)
    #define             camel_cert_set_fingerprint          (certdb,
                                                             cert,
                                                             fingerprint)
    CamelCertTrust      camel_cert_get_trust                (CamelCertDB *certdb,
                                                             CamelCert *cert);
    void                camel_cert_set_trust                (CamelCertDB *certdb,
                                                             CamelCert *cert,
                                                             CamelCertTrust trust);
    enum                CamelCertDBLock;
    void                camel_certdb_lock                   (CamelCertDB *certdb,
                                                             CamelCertDBLock lock);
    void                camel_certdb_unlock                 (CamelCertDB *certdb,
                                                             CamelCertDBLock lock);

## Object Hierarchy

      GObject
       +----CamelObject
             +----CamelCertDB

## Description

## Details

### enum CamelCertDBFlags

    typedef enum {
    	CAMEL_CERTDB_DIRTY = 1 << 0
    } CamelCertDBFlags;

### struct CamelCertDB

    struct CamelCertDB;

### enum CamelCertTrust

    typedef enum {
    	CAMEL_CERT_TRUST_UNKNOWN,
    	CAMEL_CERT_TRUST_NEVER,
    	CAMEL_CERT_TRUST_MARGINAL,
    	CAMEL_CERT_TRUST_FULLY,
    	CAMEL_CERT_TRUST_ULTIMATE
    } CamelCertTrust;

### CamelCert

    typedef struct {
    	guint32 refcount;

    	gchar *issuer;
    	gchar *subject;
    	gchar *hostname;
    	gchar *fingerprint;

    	CamelCertTrust trust;
    	GByteArray *rawcert;
    } CamelCert;

### camel_certdb_new ()

    CamelCertDB *       camel_certdb_new                    (void);

### camel_certdb_set_default ()

    void                camel_certdb_set_default            (CamelCertDB *certdb);

### camel_certdb_get_default ()

    CamelCertDB *       camel_certdb_get_default            (void);

### camel_certdb_set_filename ()

    void                camel_certdb_set_filename           (CamelCertDB *certdb,
                                                             const gchar *filename);

### camel_certdb_load ()

    gint                camel_certdb_load                   (CamelCertDB *certdb);

### camel_certdb_save ()

    gint                camel_certdb_save                   (CamelCertDB *certdb);

### camel_certdb_touch ()

    void                camel_certdb_touch                  (CamelCertDB *certdb);

### camel_certdb_get_cert ()

    CamelCert *         camel_certdb_get_cert               (CamelCertDB *certdb,
                                                             const gchar *fingerprint);

### camel_certdb_add ()

    void                camel_certdb_add                    (CamelCertDB *certdb,
                                                             CamelCert *cert);

### camel_certdb_remove ()

    void                camel_certdb_remove                 (CamelCertDB *certdb,
                                                             CamelCert *cert);

### camel_certdb_cert_new ()

    CamelCert *         camel_certdb_cert_new               (CamelCertDB *certdb);

### camel_certdb_cert_ref ()

    void                camel_certdb_cert_ref               (CamelCertDB *certdb,
                                                             CamelCert *cert);

### camel_certdb_cert_unref ()

    void                camel_certdb_cert_unref             (CamelCertDB *certdb,
                                                             CamelCert *cert);

### camel_certdb_clear ()

    void                camel_certdb_clear                  (CamelCertDB *certdb);

### camel_cert_get_string ()

    const gchar *       camel_cert_get_string               (CamelCertDB *certdb,
                                                             CamelCert *cert,
                                                             gint string);

### camel_cert_set_string ()

    void                camel_cert_set_string               (CamelCertDB *certdb,
                                                             CamelCert *cert,
                                                             gint string,
                                                             const gchar *value);

### camel_cert_get_issuer()

    #define camel_cert_get_issuer(certdb,cert) camel_cert_get_string (certdb, cert, CAMEL_CERT_STRING_ISSUER)

### camel_cert_get_subject()

    #define camel_cert_get_subject(certdb,cert) camel_cert_get_string (certdb, cert, CAMEL_CERT_STRING_SUBJECT)

### camel_cert_get_hostname()

    #define camel_cert_get_hostname(certdb,cert) camel_cert_get_string (certdb, cert, CAMEL_CERT_STRING_HOSTNAME)

### camel_cert_get_fingerprint()

    #define camel_cert_get_fingerprint(certdb,cert) camel_cert_get_string (certdb, cert, CAMEL_CERT_STRING_FINGERPRINT)

### camel_cert_set_issuer()

    #define camel_cert_set_issuer(certdb,cert,issuer) camel_cert_set_string (certdb, cert, CAMEL_CERT_STRING_ISSUER, issuer)

### camel_cert_set_subject()

    #define camel_cert_set_subject(certdb,cert,subject) camel_cert_set_string (certdb, cert, CAMEL_CERT_STRING_SUBJECT, subject)

### camel_cert_set_hostname()

    #define camel_cert_set_hostname(certdb,cert,hostname) camel_cert_set_string (certdb, cert, CAMEL_CERT_STRING_HOSTNAME, hostname)

### camel_cert_set_fingerprint()

    #define camel_cert_set_fingerprint(certdb,cert,fingerprint) camel_cert_set_string (certdb, cert, CAMEL_CERT_STRING_FINGERPRINT, fingerprint)

### camel_cert_get_trust ()

    CamelCertTrust      camel_cert_get_trust                (CamelCertDB *certdb,
                                                             CamelCert *cert);

### camel_cert_set_trust ()

    void                camel_cert_set_trust                (CamelCertDB *certdb,
                                                             CamelCert *cert,
                                                             CamelCertTrust trust);

### enum CamelCertDBLock

    typedef enum {
    	CAMEL_CERTDB_DB_LOCK,
    	CAMEL_CERTDB_IO_LOCK,
    	CAMEL_CERTDB_ALLOC_LOCK,
    	CAMEL_CERTDB_REF_LOCK
    } CamelCertDBLock;

Since 2.32

### camel_certdb_lock ()

    void                camel_certdb_lock                   (CamelCertDB *certdb,
                                                             CamelCertDBLock lock);

Locks certdb's lock. Unlock it with `camel_certdb_unlock()`.

`certdb` : | a CamelCertDB
`lock` : | lock type to lock

Since 2.32

### camel_certdb_unlock ()

    void                camel_certdb_unlock                 (CamelCertDB *certdb,
                                                             CamelCertDBLock lock);

Unlocks certdb's lock, previously locked with `camel_certdb_lock()`.

`certdb` : | a CamelCertDB
`lock` : | lock type to unlock

Since 2.32