CamelCertDB
3
CAMEL Library

# CamelCertDB

## Synopsis

                        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 char *filename);
    int                 camel_certdb_load                   (CamelCertDB *certdb);
    int                 camel_certdb_save                   (CamelCertDB *certdb);
    void                camel_certdb_touch                  (CamelCertDB *certdb);
    CamelCert*          camel_certdb_get_cert               (CamelCertDB *certdb,
                                                             const char *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 char*         camel_cert_get_string               (CamelCertDB *certdb,
                                                             CamelCert *cert,
                                                             int string);
    void                camel_cert_set_string               (CamelCertDB *certdb,
                                                             CamelCert *cert,
                                                             int string,
                                                             const char *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);

## Description

## Details

### CamelCertDB

    typedef struct {
    	CamelObject parent_object;
    	struct _CamelCertDBPrivate *priv;

    	char *filename;
    	guint32 version;
    	guint32 saved_certs;
    	guint32 flags;

    	guint32 cert_size;

    	struct _EMemChunk *cert_chunks;

    	GPtrArray *certs;
    	GHashTable *cert_hash;
    } 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;

    	char *issuer;
    	char *subject;
    	char *hostname;
    	char *fingerprint;

    	CamelCertTrust trust;
    	GByteArray *rawcert;
    } CamelCert;

### camel_certdb_new ()

    CamelCertDB*        camel_certdb_new                    (void);

Returns :

### camel_certdb_set_default ()

    void                camel_certdb_set_default            (CamelCertDB *certdb);

`certdb` :

### camel_certdb_get_default ()

    CamelCertDB*        camel_certdb_get_default            (void);

Returns :

### camel_certdb_set_filename ()

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

`certdb` :

`filename` :

### camel_certdb_load ()

    int                 camel_certdb_load                   (CamelCertDB *certdb);

`certdb` :

Returns :

### camel_certdb_save ()

    int                 camel_certdb_save                   (CamelCertDB *certdb);

`certdb` :

Returns :

### camel_certdb_touch ()

    void                camel_certdb_touch                  (CamelCertDB *certdb);

`certdb` :

### camel_certdb_get_cert ()

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

`certdb` :

`fingerprint` :

Returns :

### camel_certdb_add ()

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

`certdb` :

`cert` :

### camel_certdb_remove ()

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

`certdb` :

`cert` :

### camel_certdb_cert_new ()

    CamelCert*          camel_certdb_cert_new               (CamelCertDB *certdb);

`certdb` :

Returns :

### camel_certdb_cert_ref ()

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

`certdb` :

`cert` :

### camel_certdb_cert_unref ()

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

`certdb` :

`cert` :

### camel_certdb_clear ()

    void                camel_certdb_clear                  (CamelCertDB *certdb);

`certdb` :

### camel_cert_get_string ()

    const char*         camel_cert_get_string               (CamelCertDB *certdb,
                                                             CamelCert *cert,
                                                             int string);

`certdb` :

`cert` :

`string` :

Returns :

### camel_cert_set_string ()

    void                camel_cert_set_string               (CamelCertDB *certdb,
                                                             CamelCert *cert,
                                                             int string,
                                                             const char *value);

`certdb` :

`cert` :

`string` :

`value` :

### camel_cert_get_issuer()

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

`certdb` :

`cert` :

### camel_cert_get_subject()

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

`certdb` :

`cert` :

### camel_cert_get_hostname()

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

`certdb` :

`cert` :

### camel_cert_get_fingerprint()

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

`certdb` :

`cert` :

### camel_cert_set_issuer()

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

`certdb` :

`cert` :

`issuer` :

### camel_cert_set_subject()

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

`certdb` :

`cert` :

`subject` :

### camel_cert_set_hostname()

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

`certdb` :

`cert` :

`hostname` :

### camel_cert_set_fingerprint()

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

`certdb` :

`cert` :

`fingerprint` :

### camel_cert_get_trust ()

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

`certdb` :

`cert` :

Returns :

### camel_cert_set_trust ()

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

`certdb` :

`cert` :

`trust` :