GMimeCryptoContext

GMimeCryptoContext — Encryption/signing contexts

Synopsis

gboolean            (*GMimePasswordRequestFunc)         (GMimeCryptoContext *ctx,
                                                         const char *user_id,
                                                         const char *prompt_ctx,
                                                         gboolean reprompt,
                                                         GMimeStream *response,
                                                         GError **err);
enum                GMimeCryptoHash;
                    GMimeCryptoContext;
void                g_mime_crypto_context_set_request_password
                                                        (GMimeCryptoContext *ctx,
                                                         GMimePasswordRequestFunc request_passwd);
const char *        g_mime_crypto_context_get_signature_protocol
                                                        (GMimeCryptoContext *ctx);
const char *        g_mime_crypto_context_get_encryption_protocol
                                                        (GMimeCryptoContext *ctx);
const char *        g_mime_crypto_context_get_key_exchange_protocol
                                                        (GMimeCryptoContext *ctx);
GMimeCryptoHash     g_mime_crypto_context_hash_id       (GMimeCryptoContext *ctx,
                                                         const char *hash);
const char *        g_mime_crypto_context_hash_name     (GMimeCryptoContext *ctx,
                                                         GMimeCryptoHash hash);
int                 g_mime_crypto_context_sign          (GMimeCryptoContext *ctx,
                                                         const char *userid,
                                                         GMimeCryptoHash hash,
                                                         GMimeStream *istream,
                                                         GMimeStream *ostream,
                                                         GError **err);
GMimeSignatureValidity * g_mime_crypto_context_verify   (GMimeCryptoContext *ctx,
                                                         GMimeCryptoHash hash,
                                                         GMimeStream *istream,
                                                         GMimeStream *sigstream,
                                                         GError **err);
int                 g_mime_crypto_context_encrypt       (GMimeCryptoContext *ctx,
                                                         gboolean sign,
                                                         const char *userid,
                                                         GMimeCryptoHash hash,
                                                         GPtrArray *recipients,
                                                         GMimeStream *istream,
                                                         GMimeStream *ostream,
                                                         GError **err);
GMimeDecryptionResult * g_mime_crypto_context_decrypt   (GMimeCryptoContext *ctx,
                                                         GMimeStream *istream,
                                                         GMimeStream *ostream,
                                                         GError **err);
int                 g_mime_crypto_context_import_keys   (GMimeCryptoContext *ctx,
                                                         GMimeStream *istream,
                                                         GError **err);
int                 g_mime_crypto_context_export_keys   (GMimeCryptoContext *ctx,
                                                         GPtrArray *keys,
                                                         GMimeStream *ostream,
                                                         GError **err);

enum                GMimeCryptoPubKeyAlgo;
enum                GMimeSignerStatus;
enum                GMimeSignerTrust;
enum                GMimeSignerError;
                    GMimeSigner;
GMimeSigner *       g_mime_signer_new                   (GMimeSignerStatus status);
void                g_mime_signer_free                  (GMimeSigner *signer);
const GMimeSigner * g_mime_signer_next                  (const GMimeSigner *signer);
GMimeSignerStatus   g_mime_signer_get_status            (const GMimeSigner *signer);
void                g_mime_signer_set_status            (GMimeSigner *signer,
                                                         GMimeSignerStatus status);
GMimeSignerError    g_mime_signer_get_errors            (const GMimeSigner *signer);
void                g_mime_signer_set_errors            (GMimeSigner *signer,
                                                         GMimeSignerError error);
GMimeSignerTrust    g_mime_signer_get_trust             (const GMimeSigner *signer);
void                g_mime_signer_set_trust             (GMimeSigner *signer,
                                                         GMimeSignerTrust trust);
GMimeCryptoHash     g_mime_signer_get_hash_algo         (const GMimeSigner *signer);
void                g_mime_signer_set_hash_algo         (GMimeSigner *signer,
                                                         GMimeCryptoHash hash);
GMimeCryptoPubKeyAlgo  g_mime_signer_get_pubkey_algo    (const GMimeSigner *signer);
void                g_mime_signer_set_pubkey_algo       (GMimeSigner *signer,
                                                         GMimeCryptoPubKeyAlgo pubkey_algo);
const char *        g_mime_signer_get_issuer_serial     (const GMimeSigner *signer);
void                g_mime_signer_set_issuer_serial     (GMimeSigner *signer,
                                                         const char *issuer_serial);
const char *        g_mime_signer_get_issuer_name       (const GMimeSigner *signer);
void                g_mime_signer_set_issuer_name       (GMimeSigner *signer,
                                                         const char *issuer_name);
const char *        g_mime_signer_get_fingerprint       (const GMimeSigner *signer);
void                g_mime_signer_set_fingerprint       (GMimeSigner *signer,
                                                         const char *fingerprint);
int                 g_mime_signer_get_sig_class         (const GMimeSigner *signer);
void                g_mime_signer_set_sig_class         (GMimeSigner *signer,
                                                         int sig_class);
int                 g_mime_signer_get_sig_version       (const GMimeSigner *signer);
void                g_mime_signer_set_sig_version       (GMimeSigner *signer,
                                                         int version);
time_t              g_mime_signer_get_sig_created       (const GMimeSigner *signer);
void                g_mime_signer_set_sig_created       (GMimeSigner *signer,
                                                         time_t created);
time_t              g_mime_signer_get_sig_expires       (const GMimeSigner *signer);
void                g_mime_signer_set_sig_expires       (GMimeSigner *signer,
                                                         time_t expires);
time_t              g_mime_signer_get_key_created       (const GMimeSigner *signer);
void                g_mime_signer_set_key_created       (GMimeSigner *signer,
                                                         time_t created);
time_t              g_mime_signer_get_key_expires       (const GMimeSigner *signer);
void                g_mime_signer_set_key_expires       (GMimeSigner *signer,
                                                         time_t expires);
const char *        g_mime_signer_get_key_id            (const GMimeSigner *signer);
void                g_mime_signer_set_key_id            (GMimeSigner *signer,
                                                         const char *key_id);
const char *        g_mime_signer_get_email             (const GMimeSigner *signer);
void                g_mime_signer_set_email             (GMimeSigner *signer,
                                                         const char *email);
const char *        g_mime_signer_get_name              (const GMimeSigner *signer);
void                g_mime_signer_set_name              (GMimeSigner *signer,
                                                         const char *name);

                    GMimeSignatureValidity;
GMimeSignatureValidity * g_mime_signature_validity_new  (void);
void                g_mime_signature_validity_free      (GMimeSignatureValidity *validity);
void                g_mime_signature_validity_set_details
                                                        (GMimeSignatureValidity *validity,
                                                         const char *details);
const char *        g_mime_signature_validity_get_details
                                                        (const GMimeSignatureValidity *validity);
void                g_mime_signature_validity_add_signer
                                                        (GMimeSignatureValidity *validity,
                                                         GMimeSigner *signer);
const GMimeSigner * g_mime_signature_validity_get_signers
                                                        (const GMimeSignatureValidity *validity);

                    GMimeCryptoRecipient;
GMimeCryptoRecipient * g_mime_crypto_recipient_new      (void);
void                g_mime_crypto_recipient_free        (GMimeCryptoRecipient *recipient);
const GMimeCryptoRecipient * g_mime_crypto_recipient_next
                                                        (const GMimeCryptoRecipient *recipient);
void                g_mime_crypto_recipient_set_key_id  (GMimeCryptoRecipient *recipient,
                                                         const char *key_id);
const char *        g_mime_crypto_recipient_get_key_id  (const GMimeCryptoRecipient *recipient);
void                g_mime_crypto_recipient_set_pubkey_algo
                                                        (GMimeCryptoRecipient *recipient,
                                                         GMimeCryptoPubKeyAlgo pubkey_algo);
GMimeCryptoPubKeyAlgo  g_mime_crypto_recipient_get_pubkey_algo
                                                        (const GMimeCryptoRecipient *recipient);

enum                GMimeCryptoCipherAlgo;
                    GMimeDecryptionResult;
GMimeDecryptionResult * g_mime_decryption_result_new    (void);
void                g_mime_decryption_result_free       (GMimeDecryptionResult *result);
void                g_mime_decryption_result_set_validity
                                                        (GMimeDecryptionResult *result,
                                                         GMimeSignatureValidity *validity);
const GMimeSignatureValidity * g_mime_decryption_result_get_validity
                                                        (const GMimeDecryptionResult *result);
void                g_mime_decryption_result_add_recipient
                                                        (GMimeDecryptionResult *result,
                                                         GMimeCryptoRecipient *recipient);
const GMimeCryptoRecipient * g_mime_decryption_result_get_recipients
                                                        (const GMimeDecryptionResult *result);
void                g_mime_decryption_result_set_cipher (GMimeDecryptionResult *result,
                                                         GMimeCryptoCipherAlgo cipher);
GMimeCryptoCipherAlgo  g_mime_decryption_result_get_cipher
                                                        (const GMimeDecryptionResult *result);
void                g_mime_decryption_result_set_mdc    (GMimeDecryptionResult *result,
                                                         GMimeCryptoHash mdc);
GMimeCryptoHash     g_mime_decryption_result_get_mdc    (const GMimeDecryptionResult *result);

Description

A GMimeCryptoContext is used for encrypting, decrypting, signing and verifying cryptographic signatures.

Details

GMimePasswordRequestFunc ()

gboolean            (*GMimePasswordRequestFunc)         (GMimeCryptoContext *ctx,
                                                         const char *user_id,
                                                         const char *prompt_ctx,
                                                         gboolean reprompt,
                                                         GMimeStream *response,
                                                         GError **err);

A password request callback allowing a GMimeCryptoContext to prompt the user for a password for a given key.

ctx :

the GMimeCryptoContext making the request

user_id :

the user_id of the password being requested

prompt_ctx :

a string containing some helpful context for the prompt

reprompt :

TRUE if this password request is a reprompt due to a previously bad password response

response :

a stream for the application to write the password to (followed by a newline '\n' character)

err :

a GError for the callback to set if an error occurs

Returns :

TRUE on success or FALSE on error.

enum GMimeCryptoHash

typedef enum {
	GMIME_CRYPTO_HASH_DEFAULT     = 0,
	GMIME_CRYPTO_HASH_MD5         = 1,
	GMIME_CRYPTO_HASH_SHA1        = 2,
	GMIME_CRYPTO_HASH_RIPEMD160   = 3,
	GMIME_CRYPTO_HASH_MD2         = 5,
	GMIME_CRYPTO_HASH_TIGER192    = 6,
	GMIME_CRYPTO_HASH_HAVAL5160   = 7,
	GMIME_CRYPTO_HASH_SHA256      = 8,
	GMIME_CRYPTO_HASH_SHA384      = 9,
	GMIME_CRYPTO_HASH_SHA512      = 10,
	GMIME_CRYPTO_HASH_SHA224      = 11,
	GMIME_CRYPTO_HASH_MD4         = 301,
} GMimeCryptoHash;

A hash algorithm.

GMIME_CRYPTO_HASH_DEFAULT

The default hash algorithm.

GMIME_CRYPTO_HASH_MD5

The MD5 hash algorithm.

GMIME_CRYPTO_HASH_SHA1

The SHA-1 hash algorithm.

GMIME_CRYPTO_HASH_RIPEMD160

The RIPEMD-160 hash algorithm.

GMIME_CRYPTO_HASH_MD2

The MD2 hash algorithm.

GMIME_CRYPTO_HASH_TIGER192

The TIGER-192 hash algorithm.

GMIME_CRYPTO_HASH_HAVAL5160

The HAVAL-5-160 hash algorithm.

GMIME_CRYPTO_HASH_SHA256

The SHA-256 hash algorithm.

GMIME_CRYPTO_HASH_SHA384

The SHA-384 hash algorithm.

GMIME_CRYPTO_HASH_SHA512

The SHA-512 hash algorithm.

GMIME_CRYPTO_HASH_SHA224

The SHA-224 hash algorithm.

GMIME_CRYPTO_HASH_MD4

The MD4 hash algorithm.

GMimeCryptoContext

typedef struct {
	GObject parent_object;
	
	GMimePasswordRequestFunc request_passwd;
} GMimeCryptoContext;

A crypto context for use with MIME.

GObject parent_object;

parent GObject

GMimePasswordRequestFunc request_passwd;

a callback for requesting a password

g_mime_crypto_context_set_request_password ()

void                g_mime_crypto_context_set_request_password
                                                        (GMimeCryptoContext *ctx,
                                                         GMimePasswordRequestFunc request_passwd);

Sets the function used by the ctx for requesting a password from the user.

ctx :

a GMimeCryptoContext

request_passwd :

a callback function for requesting a password

g_mime_crypto_context_get_signature_protocol ()

const char *        g_mime_crypto_context_get_signature_protocol
                                                        (GMimeCryptoContext *ctx);

Gets the signature protocol for the crypto context.

ctx :

a GMimeCryptoContext

Returns :

the signature protocol or NULL if not supported.

g_mime_crypto_context_get_encryption_protocol ()

const char *        g_mime_crypto_context_get_encryption_protocol
                                                        (GMimeCryptoContext *ctx);

Gets the encryption protocol for the crypto context.

ctx :

a GMimeCryptoContext

Returns :

the encryption protocol or NULL if not supported.

g_mime_crypto_context_get_key_exchange_protocol ()

const char *        g_mime_crypto_context_get_key_exchange_protocol
                                                        (GMimeCryptoContext *ctx);

Gets the key exchange protocol for the crypto context.

ctx :

a GMimeCryptoContext

Returns :

the key exchange protocol or NULL if not supported.

g_mime_crypto_context_hash_id ()

GMimeCryptoHash     g_mime_crypto_context_hash_id       (GMimeCryptoContext *ctx,
                                                         const char *hash);

Gets the hash id based on the hash name hash.

ctx :

a GMimeCryptoContext

hash :

hash name

Returns :

the equivalent hash id or GMIME_CRYPTO_HASH_DEFAULT on fail.

g_mime_crypto_context_hash_name ()

const char *        g_mime_crypto_context_hash_name     (GMimeCryptoContext *ctx,
                                                         GMimeCryptoHash hash);

Gets the hash name based on the hash id hash.

ctx :

a GMimeCryptoContext

hash :

hash id

Returns :

the equivalent hash name or NULL on fail.

g_mime_crypto_context_sign ()

int                 g_mime_crypto_context_sign          (GMimeCryptoContext *ctx,
                                                         const char *userid,
                                                         GMimeCryptoHash hash,
                                                         GMimeStream *istream,
                                                         GMimeStream *ostream,
                                                         GError **err);

Signs the input stream and writes the resulting signature to the output stream.

ctx :

a GMimeCryptoContext

userid :

private key to use to sign the stream

hash :

digest algorithm to use

istream :

input stream

ostream :

output stream

err :

a GError

Returns :

the GMimeCryptoHash used on success (useful if hash is specified as GMIME_CRYPTO_HASH_DEFAULT) or -1 on fail.

g_mime_crypto_context_verify ()

GMimeSignatureValidity * g_mime_crypto_context_verify   (GMimeCryptoContext *ctx,
                                                         GMimeCryptoHash hash,
                                                         GMimeStream *istream,
                                                         GMimeStream *sigstream,
                                                         GError **err);

Verifies the signature. If istream is a clearsigned stream, you should pass NULL as the sigstream parameter. Otherwise sigstream is assumed to be the signature stream and is used to verify the integirity of the istream.

ctx :

a GMimeCryptoContext

hash :

digest algorithm used, if known

istream :

input stream

sigstream :

optional detached-signature stream

err :

a GError

Returns :

a GMimeSignatureValidity structure containing information about the integrity of the input stream or NULL on failure to execute at all.

g_mime_crypto_context_encrypt ()

int                 g_mime_crypto_context_encrypt       (GMimeCryptoContext *ctx,
                                                         gboolean sign,
                                                         const char *userid,
                                                         GMimeCryptoHash hash,
                                                         GPtrArray *recipients,
                                                         GMimeStream *istream,
                                                         GMimeStream *ostream,
                                                         GError **err);

Encrypts (and optionally signs) the cleartext input stream and writes the resulting ciphertext to the output stream.

ctx :

a GMimeCryptoContext

sign :

sign as well as encrypt

userid :

key id (or email address) to use when signing (assuming sign is TRUE)

hash :

digest algorithm to use when signing

recipients :

an array of recipient key ids and/or email addresses

istream :

cleartext input stream

ostream :

ciphertext output stream

err :

a GError

Returns :

0 on success or -1 on fail.

g_mime_crypto_context_decrypt ()

GMimeDecryptionResult * g_mime_crypto_context_decrypt   (GMimeCryptoContext *ctx,
                                                         GMimeStream *istream,
                                                         GMimeStream *ostream,
                                                         GError **err);

Decrypts the ciphertext input stream and writes the resulting cleartext to the output stream.

If the encrypted input stream was also signed, the returned GMimeDecryptionResult will have a non-NULL GMimeSignatureValidity which will contain a list of signers, each with a GMimeSignerStatus (among other details about each signer).

On success, the returned GMimeDecryptionResult will contain a list of recipient keys that the original encrypted stream was encrypted to.

ctx :

a GMimeCryptoContext

istream :

input/ciphertext stream

ostream :

output/cleartext stream

err :

a GError

Returns :

a GMimeDecryptionResult on success or NULL on error.

g_mime_crypto_context_import_keys ()

int                 g_mime_crypto_context_import_keys   (GMimeCryptoContext *ctx,
                                                         GMimeStream *istream,
                                                         GError **err);

Imports a stream of keys/certificates contained within istream into the key/certificate database controlled by ctx.

ctx :

a GMimeCryptoContext

istream :

input stream (containing keys)

err :

a GError

Returns :

0 on success or -1 on fail.

g_mime_crypto_context_export_keys ()

int                 g_mime_crypto_context_export_keys   (GMimeCryptoContext *ctx,
                                                         GPtrArray *keys,
                                                         GMimeStream *ostream,
                                                         GError **err);

Exports the keys/certificates in keys to the stream ostream from the key/certificate database controlled by ctx.

ctx :

a GMimeCryptoContext

keys :

an array of key ids

ostream :

output stream

err :

a GError

Returns :

0 on success or -1 on fail.

enum GMimeCryptoPubKeyAlgo

typedef enum {
	GMIME_CRYPTO_PUBKEY_ALGO_DEFAULT  = 0,
	GMIME_CRYPTO_PUBKEY_ALGO_RSA      = 1,
	GMIME_CRYPTO_PUBKEY_ALGO_RSA_E    = 2,
	GMIME_CRYPTO_PUBKEY_ALGO_RSA_S    = 3,
	GMIME_CRYPTO_PUBKEY_ALGO_ELG_E    = 16,
	GMIME_CRYPTO_PUBKEY_ALGO_DSA      = 17,
	GMIME_CRYPTO_PUBKEY_ALGO_ELG      = 20
} GMimeCryptoPubKeyAlgo;

A public-key algorithm.

GMIME_CRYPTO_PUBKEY_ALGO_DEFAULT

The default public-key algorithm.

GMIME_CRYPTO_PUBKEY_ALGO_RSA

The RSA algorithm.

GMIME_CRYPTO_PUBKEY_ALGO_RSA_E

An encryption-only RSA algorithm.

GMIME_CRYPTO_PUBKEY_ALGO_RSA_S

A signature-only RSA algorithm.

GMIME_CRYPTO_PUBKEY_ALGO_ELG_E

An encryption-only ElGamal algorithm.

GMIME_CRYPTO_PUBKEY_ALGO_DSA

The DSA algorithm.

GMIME_CRYPTO_PUBKEY_ALGO_ELG

The ElGamal algorithm.

enum GMimeSignerStatus

typedef enum {
	GMIME_SIGNER_STATUS_GOOD,
	GMIME_SIGNER_STATUS_ERROR,
	GMIME_SIGNER_STATUS_BAD
} GMimeSignerStatus;

A value representing the signature status for a particular GMimeSigner.

GMIME_SIGNER_STATUS_GOOD

Good signature.

GMIME_SIGNER_STATUS_ERROR

An error occurred.

GMIME_SIGNER_STATUS_BAD

Bad signature.

enum GMimeSignerTrust

typedef enum {
	GMIME_SIGNER_TRUST_NONE,
	GMIME_SIGNER_TRUST_NEVER,
	GMIME_SIGNER_TRUST_UNDEFINED,
	GMIME_SIGNER_TRUST_MARGINAL,
	GMIME_SIGNER_TRUST_FULLY,
	GMIME_SIGNER_TRUST_ULTIMATE
} GMimeSignerTrust;

The trust value of a signer.

GMIME_SIGNER_TRUST_NONE

No trust assigned.

GMIME_SIGNER_TRUST_NEVER

Never trust this signer.

GMIME_SIGNER_TRUST_UNDEFINED

Undefined trust for this signer.

GMIME_SIGNER_TRUST_MARGINAL

Trust this signer maginally.

GMIME_SIGNER_TRUST_FULLY

Trust this signer fully.

GMIME_SIGNER_TRUST_ULTIMATE

Trust this signer ultimately.

enum GMimeSignerError

typedef enum {
	GMIME_SIGNER_ERROR_NONE        = 0,
	GMIME_SIGNER_ERROR_EXPSIG      = (1 << 0),  /* expired signature */
	GMIME_SIGNER_ERROR_NO_PUBKEY   = (1 << 1),  /* no public key */
	GMIME_SIGNER_ERROR_EXPKEYSIG   = (1 << 2),  /* expired key */
	GMIME_SIGNER_ERROR_REVKEYSIG   = (1 << 3),  /* revoked key */
	GMIME_SIGNER_ERROR_UNSUPP_ALGO = (1 << 4)   /* unsupported algorithm */
} GMimeSignerError;

Possible errors that a GMimeSigner could have.

GMIME_SIGNER_ERROR_NONE

No error.

GMIME_SIGNER_ERROR_EXPSIG

Expired signature.

GMIME_SIGNER_ERROR_NO_PUBKEY

No public key found.

GMIME_SIGNER_ERROR_EXPKEYSIG

Expired signature key.

GMIME_SIGNER_ERROR_REVKEYSIG

Revoked signature key.

GMIME_SIGNER_ERROR_UNSUPP_ALGO

Unsupported algorithm.

GMimeSigner

typedef struct {
	GMimeSigner *next;
	unsigned int status:2;    /* GMimeSignerStatus */
	unsigned int errors:6;    /* bitfield of GMimeSignerError's */
	unsigned int trust:3;     /* GMimeSignerTrust */
	unsigned int unused:5;    /* unused expansion bits */
	unsigned int sig_class:8; /* crypto-specific signature class */
	unsigned int sig_ver:8;   /* crypto-specific signature version */
	GMimeCryptoPubKeyAlgo pubkey_algo;
	GMimeCryptoHash hash_algo;
	char *issuer_serial;
	char *issuer_name;
	char *fingerprint;
	time_t sig_created;
	time_t sig_expires;
	time_t key_created;
	time_t key_expires;
	char *keyid;
	char *email;
	char *name;
} GMimeSigner;

A structure containing useful information about a signer.

GMimeSigner *next;

Pointer to the next GMimeSigner.

unsigned int status :2;

A GMimeSignerStatus.

unsigned int errors :6;

A bitfield of GMimeSignerError values.

unsigned int trust :3;

A GMimeSignerTrust.

unsigned int unused :5;

Unused expansion bits for future use; ignore this.

unsigned int sig_class :8;

Crypto-specific signature class.

unsigned int sig_ver :8;

Crypto-specific signature version.

GMimeCryptoPubKeyAlgo pubkey_algo;

The public-key algorithm used by the signer, if known.

GMimeCryptoHash hash_algo;

The hash algorithm used by the signer, if known.

char *issuer_serial;

The issuer of the certificate, if known.

char *issuer_name;

The issuer of the certificate, if known.

char *fingerprint;

A hex string representing the signer's fingerprint.

time_t sig_created;

The creation date of the signature.

time_t sig_expires;

The expiration date of the signature.

time_t key_created;

The creation date of the signature key.

time_t key_expires;

The expiration date of the signature key.

char *keyid;

The signer's key id.

char *email;

The email address of the person or entity.

char *name;

The name of the person or entity.

g_mime_signer_new ()

GMimeSigner *       g_mime_signer_new                   (GMimeSignerStatus status);

Allocates an new GMimeSigner with the designated status. This function is meant to be used in GMimeCryptoContext subclasses when allocating signers to add to a GMimeSignatureValidity.

status :

A GMimeSignerStatus

Returns :

a new GMimeSigner with the designated status.

g_mime_signer_free ()

void                g_mime_signer_free                  (GMimeSigner *signer);

Frees the singleton signer. Should NOT be used to free signers returned from g_mime_signature_validity_get_signers().

signer :

a GMimeSigner

g_mime_signer_next ()

const GMimeSigner * g_mime_signer_next                  (const GMimeSigner *signer);

Advance to the next signer.

signer :

a GMimeSigner

Returns :

the next GMimeSigner or NULL when complete.

g_mime_signer_get_status ()

GMimeSignerStatus   g_mime_signer_get_status            (const GMimeSigner *signer);

Get the signer status.

signer :

a GMimeSigner

Returns :

the signer status.

g_mime_signer_set_status ()

void                g_mime_signer_set_status            (GMimeSigner *signer,
                                                         GMimeSignerStatus status);

Set the status on the signer.

signer :

a GMimeSigner

status :

a GMimeSignerStatus

g_mime_signer_get_errors ()

GMimeSignerError    g_mime_signer_get_errors            (const GMimeSigner *signer);

Get the signer errors. If the GMimeSignerStatus returned from g_mime_signer_get_status() is not GMIME_SIGNER_STATUS_GOOD, then the errors may provide a clue as to why.

signer :

a GMimeSigner

Returns :

the signer errors.

g_mime_signer_set_errors ()

void                g_mime_signer_set_errors            (GMimeSigner *signer,
                                                         GMimeSignerError error);

Set the errors on the signer.

signer :

a GMimeSigner

error :

a GMimeSignerError

g_mime_signer_get_trust ()

GMimeSignerTrust    g_mime_signer_get_trust             (const GMimeSigner *signer);

Get the signer trust.

signer :

a GMimeSigner

Returns :

the signer trust.

g_mime_signer_set_trust ()

void                g_mime_signer_set_trust             (GMimeSigner *signer,
                                                         GMimeSignerTrust trust);

Set the signer trust.

signer :

a GMimeSigner

trust :

a GMimeSignerTrust

g_mime_signer_get_hash_algo ()

GMimeCryptoHash     g_mime_signer_get_hash_algo         (const GMimeSigner *signer);

Get the hash algorithm used by the signer.

signer :

a GMimeSigner

Returns :

the hash algorithm used by the signer.

g_mime_signer_set_hash_algo ()

void                g_mime_signer_set_hash_algo         (GMimeSigner *signer,
                                                         GMimeCryptoHash hash);

Set the hash algorithm used by the signer.

signer :

a GMimeSigner

hash :

a GMimeCryptoHash

g_mime_signer_get_pubkey_algo ()

GMimeCryptoPubKeyAlgo  g_mime_signer_get_pubkey_algo    (const GMimeSigner *signer);

Get the public-key algorithm used by the signer.

signer :

a GMimeSigner

Returns :

the public-key algorithm used by the signer.

g_mime_signer_set_pubkey_algo ()

void                g_mime_signer_set_pubkey_algo       (GMimeSigner *signer,
                                                         GMimeCryptoPubKeyAlgo pubkey_algo);

Set the public-key algorithm used by the signer.

signer :

a GMimeSigner

pubkey_algo :

a GMimeCryptoPubKeyAlgo

g_mime_signer_get_issuer_serial ()

const char *        g_mime_signer_get_issuer_serial     (const GMimeSigner *signer);

Get the signer's issuer serial.

signer :

a GMimeSigner

Returns :

the signer's issuer serial.

g_mime_signer_set_issuer_serial ()

void                g_mime_signer_set_issuer_serial     (GMimeSigner *signer,
                                                         const char *issuer_serial);

Set the signer's issuer serial.

signer :

a GMimeSigner

issuer_serial :

signer's issuer serial

g_mime_signer_get_issuer_name ()

const char *        g_mime_signer_get_issuer_name       (const GMimeSigner *signer);

Get the signer's issuer name.

signer :

a GMimeSigner

Returns :

the signer's issuer name.

g_mime_signer_set_issuer_name ()

void                g_mime_signer_set_issuer_name       (GMimeSigner *signer,
                                                         const char *issuer_name);

Set the signer's issuer name.

signer :

a GMimeSigner

issuer_name :

signer's issuer name

g_mime_signer_get_fingerprint ()

const char *        g_mime_signer_get_fingerprint       (const GMimeSigner *signer);

Get the signer's key fingerprint.

signer :

a GMimeSigner

Returns :

the signer's key fingerprint.

g_mime_signer_set_fingerprint ()

void                g_mime_signer_set_fingerprint       (GMimeSigner *signer,
                                                         const char *fingerprint);

Set the signer's key fingerprint.

signer :

a GMimeSigner

fingerprint :

fingerprint string

g_mime_signer_get_sig_class ()

int                 g_mime_signer_get_sig_class         (const GMimeSigner *signer);

Get the signer's signature class.

signer :

a GMimeSigner

Returns :

the signer's signature class.

g_mime_signer_set_sig_class ()

void                g_mime_signer_set_sig_class         (GMimeSigner *signer,
                                                         int sig_class);

Set the signer's signature class.

signer :

a GMimeSigner

sig_class :

signature class

g_mime_signer_get_sig_version ()

int                 g_mime_signer_get_sig_version       (const GMimeSigner *signer);

Get the signer's signature version.

signer :

a GMimeSigner

Returns :

the signer's signature version.

g_mime_signer_set_sig_version ()

void                g_mime_signer_set_sig_version       (GMimeSigner *signer,
                                                         int version);

Set the signer's signature version.

signer :

a GMimeSigner

version :

signature version

g_mime_signer_get_sig_created ()

time_t              g_mime_signer_get_sig_created       (const GMimeSigner *signer);

Get the creation date of the signer's signature.

signer :

a GMimeSigner

Returns :

the creation date of the signer's signature or -1 if unknown.

g_mime_signer_set_sig_created ()

void                g_mime_signer_set_sig_created       (GMimeSigner *signer,
                                                         time_t created);

Set the creation date of the signer's signature.

signer :

a GMimeSigner

created :

creation date

g_mime_signer_get_sig_expires ()

time_t              g_mime_signer_get_sig_expires       (const GMimeSigner *signer);

Get the expiration date of the signer's signature.

signer :

a GMimeSigner

Returns :

the expiration date of the signer's signature or -1 if unknown.

g_mime_signer_set_sig_expires ()

void                g_mime_signer_set_sig_expires       (GMimeSigner *signer,
                                                         time_t expires);

Set the expiration date of the signer's signature.

signer :

a GMimeSigner

expires :

expiration date

g_mime_signer_get_key_created ()

time_t              g_mime_signer_get_key_created       (const GMimeSigner *signer);

Get the creation date of the signer's key.

signer :

a GMimeSigner

Returns :

the creation date of the signer's key or -1 if unknown.

g_mime_signer_set_key_created ()

void                g_mime_signer_set_key_created       (GMimeSigner *signer,
                                                         time_t created);

Set the creation date of the signer's key.

signer :

a GMimeSigner

created :

creation date

g_mime_signer_get_key_expires ()

time_t              g_mime_signer_get_key_expires       (const GMimeSigner *signer);

Get the expiration date of the signer's key.

signer :

a GMimeSigner

Returns :

the expiration date of the signer's key or -1 if unknown.

g_mime_signer_set_key_expires ()

void                g_mime_signer_set_key_expires       (GMimeSigner *signer,
                                                         time_t expires);

Set the expiration date of the signer's key.

signer :

a GMimeSigner

expires :

expiration date

g_mime_signer_get_key_id ()

const char *        g_mime_signer_get_key_id            (const GMimeSigner *signer);

Get the signer's key id.

signer :

a GMimeSigner

Returns :

the signer's key id.

g_mime_signer_set_key_id ()

void                g_mime_signer_set_key_id            (GMimeSigner *signer,
                                                         const char *key_id);

Set the signer's key id.

signer :

a GMimeSigner

key_id :

key id

g_mime_signer_get_email ()

const char *        g_mime_signer_get_email             (const GMimeSigner *signer);

Get the signer's email.

signer :

a GMimeSigner

Returns :

the signer's email.

g_mime_signer_set_email ()

void                g_mime_signer_set_email             (GMimeSigner *signer,
                                                         const char *email);

Set the signer's email.

signer :

a GMimeSigner

email :

signer's email

g_mime_signer_get_name ()

const char *        g_mime_signer_get_name              (const GMimeSigner *signer);

Get the signer's name.

signer :

a GMimeSigner

Returns :

the signer's name.

g_mime_signer_set_name ()

void                g_mime_signer_set_name              (GMimeSigner *signer,
                                                         const char *name);

Set the signer's name.

signer :

a GMimeSigner

name :

signer's name

GMimeSignatureValidity

typedef struct {
	GMimeSigner *signers;
	char *details;
} GMimeSignatureValidity;

A structure containing information about the signature validity of a signed stream.

GMimeSigner *signers;

A list of GMimeSigner structures.

char *details;

A string containing more user-readable details.

g_mime_signature_validity_new ()

GMimeSignatureValidity * g_mime_signature_validity_new  (void);

Creates a new GMimeSignatureValidity.

Returns :

a new GMimeSignatureValidity.

g_mime_signature_validity_free ()

void                g_mime_signature_validity_free      (GMimeSignatureValidity *validity);

Frees the memory used by validity back to the system.

validity :

a GMimeSignatureValidity

g_mime_signature_validity_set_details ()

void                g_mime_signature_validity_set_details
                                                        (GMimeSignatureValidity *validity,
                                                         const char *details);

Sets details as the status details string on validity.

validity :

a GMimeSignatureValidity

details :

details string

g_mime_signature_validity_get_details ()

const char *        g_mime_signature_validity_get_details
                                                        (const GMimeSignatureValidity *validity);

Gets any user-readable status details.

validity :

a GMimeSignatureValidity

Returns :

a user-readable string containing any status information.

g_mime_signature_validity_add_signer ()

void                g_mime_signature_validity_add_signer
                                                        (GMimeSignatureValidity *validity,
                                                         GMimeSigner *signer);

Adds signer to the list of signers on validity. Once the signer is added, it must NOT be freed.

validity :

a GMimeSignatureValidity

signer :

a GMimeSigner

g_mime_signature_validity_get_signers ()

const GMimeSigner * g_mime_signature_validity_get_signers
                                                        (const GMimeSignatureValidity *validity);

Gets the list of signers.

validity :

a GMimeSignatureValidity

Returns :

a GMimeSigner list which contain further information such as trust and crypto keys. These signers are part of the GMimeSignatureValidity and should NOT be freed individually.

GMimeCryptoRecipient

typedef struct {
	GMimeCryptoRecipient *next;
	GMimeCryptoPubKeyAlgo pubkey_algo;
	char *keyid;
} GMimeCryptoRecipient;

A structure containing useful information about a recipient.

GMimeCryptoRecipient *next;

Pointer to the next GMimeCryptoRecipient.

GMimeCryptoPubKeyAlgo pubkey_algo;

The public-key algorithm used by the recipient, if known.

char *keyid;

The recipient's key id.

g_mime_crypto_recipient_new ()

GMimeCryptoRecipient * g_mime_crypto_recipient_new      (void);

Allocates an new GMimeCryptoRecipient. This function is meant to be used in GMimeCryptoContext subclasses when allocating recipients to add to a GMimeDecryptionResult.

Returns :

a new GMimeCryptoRecipient.

g_mime_crypto_recipient_free ()

void                g_mime_crypto_recipient_free        (GMimeCryptoRecipient *recipient);

Frees the singleton recipient. Should NOT be used to free recipients returned from g_mime_signature_validity_get_recipients().

recipient :

a GMimeCryptoRecipient

g_mime_crypto_recipient_next ()

const GMimeCryptoRecipient * g_mime_crypto_recipient_next
                                                        (const GMimeCryptoRecipient *recipient);

Advance to the next recipient.

recipient :

a GMimeCryptoRecipient

Returns :

the next GMimeCryptoRecipient or NULL when complete.

g_mime_crypto_recipient_set_key_id ()

void                g_mime_crypto_recipient_set_key_id  (GMimeCryptoRecipient *recipient,
                                                         const char *key_id);

Set the recipient's key id.

recipient :

a GMimeCryptoRecipient

key_id :

key id

g_mime_crypto_recipient_get_key_id ()

const char *        g_mime_crypto_recipient_get_key_id  (const GMimeCryptoRecipient *recipient);

Get the recipient's key id.

recipient :

a GMimeCryptoRecipient

Returns :

the recipient's key id.

g_mime_crypto_recipient_set_pubkey_algo ()

void                g_mime_crypto_recipient_set_pubkey_algo
                                                        (GMimeCryptoRecipient *recipient,
                                                         GMimeCryptoPubKeyAlgo pubkey_algo);

Set the public-key algorithm used by the recipient.

recipient :

a GMimeCryptoRecipient

pubkey_algo :

a GMimeCryptoPubKeyAlgo

g_mime_crypto_recipient_get_pubkey_algo ()

GMimeCryptoPubKeyAlgo  g_mime_crypto_recipient_get_pubkey_algo
                                                        (const GMimeCryptoRecipient *recipient);

Get the public-key algorithm used by the recipient.

recipient :

a GMimeCryptoRecipient

Returns :

the public-key algorithm used by the recipient.

enum GMimeCryptoCipherAlgo

typedef enum {
	GMIME_CRYPTO_CIPHER_ALGO_DEFAULT     = 0,
	GMIME_CRYPTO_CIPHER_ALGO_IDEA        = 1,
	GMIME_CRYPTO_CIPHER_ALGO_3DES        = 2,
	GMIME_CRYPTO_CIPHER_ALGO_CAST5       = 3,
	GMIME_CRYPTO_CIPHER_ALGO_BLOWFISH    = 4,
	GMIME_CRYPTO_CIPHER_ALGO_AES         = 7,
	GMIME_CRYPTO_CIPHER_ALGO_AES192      = 8,
	GMIME_CRYPTO_CIPHER_ALGO_AES256      = 9,
	GMIME_CRYPTO_CIPHER_ALGO_TWOFISH     = 10,
	GMIME_CRYPTO_CIPHER_ALGO_CAMELLIA128 = 11,
	GMIME_CRYPTO_CIPHER_ALGO_CAMELLIA196 = 12,
	GMIME_CRYPTO_CIPHER_ALGO_CAMELLIA256 = 13
} GMimeCryptoCipherAlgo;

A cipher algorithm.

GMIME_CRYPTO_CIPHER_ALGO_DEFAULT

The default (or unknown) cipher.

GMIME_CRYPTO_CIPHER_ALGO_IDEA

The IDEA cipher.

GMIME_CRYPTO_CIPHER_ALGO_3DES

The 3DES cipher.

GMIME_CRYPTO_CIPHER_ALGO_CAST5

The CAST5 cipher.

GMIME_CRYPTO_CIPHER_ALGO_BLOWFISH

The Blowfish cipher.

GMIME_CRYPTO_CIPHER_ALGO_AES

The AES (aka RIJANDALE) cipher.

GMIME_CRYPTO_CIPHER_ALGO_AES192

The AES-192 cipher.

GMIME_CRYPTO_CIPHER_ALGO_AES256

The AES-256 cipher.

GMIME_CRYPTO_CIPHER_ALGO_TWOFISH

The Twofish cipher.

GMIME_CRYPTO_CIPHER_ALGO_CAMELLIA128

The Camellia-128 cipher.

GMIME_CRYPTO_CIPHER_ALGO_CAMELLIA196

The Camellia-196 cipher.

GMIME_CRYPTO_CIPHER_ALGO_CAMELLIA256

The Camellia-256 cipher.

GMimeDecryptionResult

typedef struct {
	GMimeSignatureValidity *validity;
	GMimeCryptoRecipient *recipients;
	GMimeCryptoCipherAlgo cipher;
	GMimeCryptoHash mdc;
} GMimeDecryptionResult;

A structure containing the results from decrypting an encrypted stream.

GMimeSignatureValidity *validity;

A GMimeSignatureValidity if signed or NULL otherwise.

GMimeCryptoRecipient *recipients;

A list of GMimeCryptoRecipient structures.

GMimeCryptoCipherAlgo cipher;

The cipher algorithm used to encrypt the stream.

GMimeCryptoHash mdc;

The MDC digest algorithm used, if any.

g_mime_decryption_result_new ()

GMimeDecryptionResult * g_mime_decryption_result_new    (void);

Creates a new GMimeDecryptionResult.

Returns :

a new GMimeDecryptionResult.

g_mime_decryption_result_free ()

void                g_mime_decryption_result_free       (GMimeDecryptionResult *result);

Frees the memory used by result back to the system.

result :

a GMimeDecryptionResult

g_mime_decryption_result_set_validity ()

void                g_mime_decryption_result_set_validity
                                                        (GMimeDecryptionResult *result,
                                                         GMimeSignatureValidity *validity);

Sets validity as the GMimeDecryptionResult.

result :

a GMimeDecryptionResult

validity :

a GMimeSignatureValidity

g_mime_decryption_result_get_validity ()

const GMimeSignatureValidity * g_mime_decryption_result_get_validity
                                                        (const GMimeDecryptionResult *result);

Gets the signature validity if the decrypted stream was also signed.

result :

a GMimeDecryptionResult

Returns :

a GMimeSignatureValidity or NULL if the stream was not signed.

g_mime_decryption_result_add_recipient ()

void                g_mime_decryption_result_add_recipient
                                                        (GMimeDecryptionResult *result,
                                                         GMimeCryptoRecipient *recipient);

Adds recipient to the list of recipients on result. Once the recipient is added, it must NOT be freed.

result :

a GMimeDecryptionResult

recipient :

a GMimeCryptoRecipient

g_mime_decryption_result_get_recipients ()

const GMimeCryptoRecipient * g_mime_decryption_result_get_recipients
                                                        (const GMimeDecryptionResult *result);

Gets the list of recipients.

result :

signature result

Returns :

a GMimeCryptoRecipient list which contain further information such as trust and crypto keys. These recipients are part of the GMimeDecryptionResult and should NOT be freed individually.

g_mime_decryption_result_set_cipher ()

void                g_mime_decryption_result_set_cipher (GMimeDecryptionResult *result,
                                                         GMimeCryptoCipherAlgo cipher);

Set the cipher algorithm used.


g_mime_decryption_result_get_cipher ()

GMimeCryptoCipherAlgo  g_mime_decryption_result_get_cipher
                                                        (const GMimeDecryptionResult *result);

Get the cipher algorithm used.

result :

a GMimeDecryptionResult

Returns :

the cipher algorithm used.

g_mime_decryption_result_set_mdc ()

void                g_mime_decryption_result_set_mdc    (GMimeDecryptionResult *result,
                                                         GMimeCryptoHash mdc);

Set the mdc digest algorithm used.

result :

a GMimeDecryptionResult

mdc :

a GMimeCryptoHash

g_mime_decryption_result_get_mdc ()

GMimeCryptoHash     g_mime_decryption_result_get_mdc    (const GMimeDecryptionResult *result);

Get the mdc digest algorithm used.

result :

a GMimeDecryptionResult

Returns :

the mdc digest algorithm used.