| GMime 2.6 Reference Manual | ||||
|---|---|---|---|---|
| Top | Description | ||||
gboolean (*GMimePasswordRequestFunc) (GMimeCryptoContext *ctx,const char *user_id,const char *prompt_ctx,gboolean reprompt,GMimeStream *response,GError **err); enum GMimeCryptoHash; GMimeCryptoContext; GMimeSignatureValidity; enum GMimeSignerStatus; enum GMimeSignerTrust; enum GMimeSignerError; GMimeSigner; void g_mime_crypto_context_set_request_password (GMimeCryptoContext *ctx,GMimePasswordRequestFunc request_passwd); 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); GMimeSignatureValidity * 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); GMimeSigner * g_mime_signer_new (GMimeSignerStatus status); void g_mime_signer_free (GMimeSigner *signer); GMimeSigner * g_mime_signer_next (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); 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 * 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);
A GMimeCryptoContext is used for encrypting, decrypting, signing and verifying cryptographic signatures.
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.
|
the GMimeCryptoContext making the request |
|
the user_id of the password being requested |
|
a string containing some helpful context for the prompt |
|
TRUE if this password request is a reprompt due to a previously bad password response
|
|
a stream for the application to write the password to (followed by a newline '\n' character) |
|
a GError for the callback to set if an error occurs |
Returns : |
TRUE on success or FALSE on error.
|
typedef enum {
GMIME_CRYPTO_HASH_DEFAULT,
GMIME_CRYPTO_HASH_MD2,
GMIME_CRYPTO_HASH_MD5,
GMIME_CRYPTO_HASH_SHA1,
GMIME_CRYPTO_HASH_SHA224,
GMIME_CRYPTO_HASH_SHA256,
GMIME_CRYPTO_HASH_SHA384,
GMIME_CRYPTO_HASH_SHA512,
GMIME_CRYPTO_HASH_RIPEMD160,
GMIME_CRYPTO_HASH_TIGER192,
GMIME_CRYPTO_HASH_HAVAL5160,
GMIME_CRYPTO_HASH_MD4
} GMimeCryptoHash;
A hash algorithm.
| The default hash algorithm. | |
| The MD2 hash algorithm. | |
| The MD5 hash algorithm. | |
| The SHA-1 hash algorithm. | |
| The SHA-224 hash algorithm. | |
| The SHA-256 hash algorithm. | |
| The SHA-384 hash algorithm. | |
| The SHA-512 hash algorithm. | |
| The RIPEMD-160 hash algorithm. | |
| The TIGER-192 hash algorithm. | |
| The HAVAL-5-160 hash algorithm. | |
| The MD4 hash algorithm. |
typedef struct {
GObject parent_object;
GMimePasswordRequestFunc request_passwd;
/* these must be set by the subclass in the instance_init() */
const char *sign_protocol;
const char *encrypt_protocol;
const char *key_protocol;
} GMimeCryptoContext;
A crypto context for use with MIME.
GObject |
parent GObject |
GMimePasswordRequestFunc |
a callback for requesting a password |
| signature protocol (must be set by subclass) | |
| encryption protocol (must be set by subclass) | |
| key exchange protocol (must be set by subclass) |
typedef struct {
GMimeSigner *signers;
char *details;
} GMimeSignatureValidity;
A structure containing information about the signature validity of a signed stream.
GMimeSigner * |
A list of GMimeSigner structures. |
| A string containing more user-readable details. |
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.
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.
| No trust assigned. | |
| Never trust this signer. | |
| Undefined trust for this signer. | |
| Trust this signer maginally. | |
| Trust this signer fully. | |
| Trust this signer ultimately. |
typedef enum {
GMIME_SIGNER_ERROR_NONE,
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 */
} GMimeSignerError;
Possible errors that a GMimeSigner could have.
typedef struct {
GMimeSigner *next;
unsigned int status:2; /* GMimeSignerStatus */
unsigned int errors:4; /* bitfield of GMimeSignerError's */
unsigned int trust:3; /* GMimeSignerTrust */
unsigned int unused:21; /* unused expansion bits */
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 * |
Pointer to the next GMimeSigner. |
| A GMimeSignerStatus. | |
| A bitfield of GMimeSignerError values. | |
| A GMimeSignerTrust. | |
| Unused expansion bits for future use; ignore this. | |
| The public-key algorithm used by the signer, if known. | |
GMimeCryptoHash |
The hash algorithm used by the signer, if known. |
| The issuer of the certificate, if known. | |
| The issuer of the certificate, if known. | |
| A hex string representing the signer's fingerprint. | |
| The creation date of the signature. | |
| The expiration date of the signature. | |
| The creation date of the signature key. | |
| The expiration date of the signature key. | |
| The signer's key id. | |
| The email address of the person or entity. | |
| The name of the person or entity. |
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.
|
a GMimeCryptoContext |
|
a callback function for requesting a password |
GMimeCryptoHash g_mime_crypto_context_hash_id (GMimeCryptoContext *ctx,const char *hash);
Gets the hash id based on the hash name hash.
|
a GMimeCryptoContext |
|
hash name |
Returns : |
the equivalent hash id or GMIME_CRYPTO_HASH_DEFAULT on fail. |
const char * g_mime_crypto_context_hash_name (GMimeCryptoContext *ctx,GMimeCryptoHash hash);
Gets the hash name based on the hash id hash.
|
a GMimeCryptoContext |
|
hash id |
Returns : |
the equivalent hash name or NULL on fail.
|
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.
|
a GMimeCryptoContext |
|
private key to use to sign the stream |
|
digest algorithm to use |
|
input stream |
|
output stream |
|
a GError |
Returns : |
the GMimeCryptoHash used on success (useful if hash is
specified as GMIME_CRYPTO_HASH_DEFAULT) or -1 on fail.
|
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.
|
a GMimeCryptoContext |
|
digest algorithm used, if known |
|
input stream |
|
optional detached-signature stream |
|
a GError |
Returns : |
a GMimeSignatureValidity structure containing information
about the integrity of the input stream or NULL on failure to
execute at all.
|
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.
|
a GMimeCryptoContext |
|
sign as well as encrypt |
|
key id (or email address) to use when signing (assuming sign is TRUE)
|
|
digest algorithm to use when signing |
|
an array of recipient key ids and/or email addresses |
|
cleartext input stream |
|
ciphertext output stream |
|
a GError |
Returns : |
0 on success or -1 on fail.
|
GMimeSignatureValidity * 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 GMimeSignatureValidity will contain a list of signers, each with a GMimeSignerStatus (among other details).
If the encrypted input text was not signed, then the GMimeSignatureValidity will not contain any signers.
|
a GMimeCryptoContext |
|
input/ciphertext stream |
|
output/cleartext stream |
|
a GError |
Returns : |
a GMimeSignatureValidity on success or NULL on error.
|
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.
|
a GMimeCryptoContext |
|
input stream (containing keys) |
|
a GError |
Returns : |
0 on success or -1 on fail.
|
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.
|
a GMimeCryptoContext |
|
an array of key ids |
|
output stream |
|
a GError |
Returns : |
0 on success or -1 on fail.
|
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.
|
A GMimeSignerStatus |
Returns : |
a new GMimeSigner with the designated status.
|
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 |
GMimeSigner * g_mime_signer_next (GMimeSigner *signer);
Advance to the next signer.
|
a GMimeSigner |
Returns : |
the next GMimeSigner or NULL when complete.
|
GMimeSignerStatus g_mime_signer_get_status (const GMimeSigner *signer);
Get the signer status.
|
a GMimeSigner |
Returns : |
the signer status. |
void g_mime_signer_set_status (GMimeSigner *signer,GMimeSignerStatus status);
Set the status on the signer.
|
a GMimeSigner |
|
a GMimeSignerStatus |
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.
|
a GMimeSigner |
Returns : |
the signer errors. |
void g_mime_signer_set_errors (GMimeSigner *signer,GMimeSignerError error);
Set the errors on the signer.
|
a GMimeSigner |
|
a GMimeSignerError |
GMimeSignerTrust g_mime_signer_get_trust (const GMimeSigner *signer);
Get the signer trust.
|
a GMimeSigner |
Returns : |
the signer trust. |
void g_mime_signer_set_trust (GMimeSigner *signer,GMimeSignerTrust trust);
Set the signer trust.
|
a GMimeSigner |
|
a GMimeSignerTrust |
GMimeCryptoHash g_mime_signer_get_hash_algo (const GMimeSigner *signer);
Get the hash algorithm used by the signer.
|
a GMimeSigner |
Returns : |
the hash algorithm used by the signer. |
void g_mime_signer_set_hash_algo (GMimeSigner *signer,GMimeCryptoHash hash);
Set the hash algorithm used by the signer.
|
a GMimeSigner |
|
a GMimeCryptoHash |
GMimeCryptoPubKeyAlgo g_mime_signer_get_pubkey_algo (const GMimeSigner *signer);
Get the public-key algorithm used by the signer.
|
a GMimeSigner |
Returns : |
the public-key algorithm used by the signer. |
void g_mime_signer_set_pubkey_algo (GMimeSigner *signer,GMimeCryptoPubKeyAlgo pubkey_algo);
Set the public-key algorithm used by the signer.
|
a GMimeSigner |
|
a GMimeCryptoPubKeyAlgo |
const char * g_mime_signer_get_issuer_serial (const GMimeSigner *signer);
Get the signer's issuer serial.
|
a GMimeSigner |
Returns : |
the signer's issuer serial. |
void g_mime_signer_set_issuer_serial (GMimeSigner *signer,const char *issuer_serial);
Set the signer's issuer serial.
|
a GMimeSigner |
|
signer's issuer serial |
const char * g_mime_signer_get_issuer_name (const GMimeSigner *signer);
Get the signer's issuer name.
|
a GMimeSigner |
Returns : |
the signer's issuer name. |
void g_mime_signer_set_issuer_name (GMimeSigner *signer,const char *issuer_name);
Set the signer's issuer name.
|
a GMimeSigner |
|
signer's issuer name |
const char * g_mime_signer_get_fingerprint (const GMimeSigner *signer);
Get the signer's key fingerprint.
|
a GMimeSigner |
Returns : |
the signer's key fingerprint. |
void g_mime_signer_set_fingerprint (GMimeSigner *signer,const char *fingerprint);
Set the signer's key fingerprint.
|
a GMimeSigner |
|
fingerprint string |
time_t g_mime_signer_get_sig_created (const GMimeSigner *signer);
Get the creation date of the signer's signature.
|
a GMimeSigner |
Returns : |
the creation date of the signer's signature or -1 if
unknown.
|
void g_mime_signer_set_sig_created (GMimeSigner *signer,time_t created);
Set the creation date of the signer's signature.
|
a GMimeSigner |
|
creation date |
time_t g_mime_signer_get_sig_expires (const GMimeSigner *signer);
Get the expiration date of the signer's signature.
|
a GMimeSigner |
Returns : |
the expiration date of the signer's signature or -1 if
unknown.
|
void g_mime_signer_set_sig_expires (GMimeSigner *signer,time_t expires);
Set the expiration date of the signer's signature.
|
a GMimeSigner |
|
expiration date |
time_t g_mime_signer_get_key_created (const GMimeSigner *signer);
Get the creation date of the signer's key.
|
a GMimeSigner |
Returns : |
the creation date of the signer's key or -1 if unknown.
|
void g_mime_signer_set_key_created (GMimeSigner *signer,time_t created);
Set the creation date of the signer's key.
|
a GMimeSigner |
|
creation date |
time_t g_mime_signer_get_key_expires (const GMimeSigner *signer);
Get the expiration date of the signer's key.
|
a GMimeSigner |
Returns : |
the expiration date of the signer's key or -1 if unknown.
|
void g_mime_signer_set_key_expires (GMimeSigner *signer,time_t expires);
Set the expiration date of the signer's key.
|
a GMimeSigner |
|
expiration date |
const char * g_mime_signer_get_key_id (const GMimeSigner *signer);
Get the signer's key id.
|
a GMimeSigner |
Returns : |
the signer's key id. |
void g_mime_signer_set_key_id (GMimeSigner *signer,const char *key_id);
Set the signer's key id.
|
a GMimeSigner |
|
key id |
const char * g_mime_signer_get_email (const GMimeSigner *signer);
Get the signer's email.
|
a GMimeSigner |
Returns : |
the signer's email. |
void g_mime_signer_set_email (GMimeSigner *signer,const char *email);
Set the signer's email.
|
a GMimeSigner |
|
signer's email |
const char * g_mime_signer_get_name (const GMimeSigner *signer);
Get the signer's name.
|
a GMimeSigner |
Returns : |
the signer's name. |
void g_mime_signer_set_name (GMimeSigner *signer,const char *name);
Set the signer's name.
|
a GMimeSigner |
|
signer's name |
GMimeSignatureValidity * g_mime_signature_validity_new (void);
Creates a new GMimeSignatureValidity.
Returns : |
a new GMimeSignatureValidity. |
void g_mime_signature_validity_free (GMimeSignatureValidity *validity);
Frees the memory used by validity back to the system.
|
signature validity |
void g_mime_signature_validity_set_details (GMimeSignatureValidity *validity,const char *details);
Sets details as the status details string on validity.
|
signature validity |
|
details string |
const char * g_mime_signature_validity_get_details
(const GMimeSignatureValidity *validity);
Gets any user-readable status details.
|
signature validity |
Returns : |
a user-readable string containing any status information. |
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.
|
signature validity |
|
signer |
const GMimeSigner * g_mime_signature_validity_get_signers
(const GMimeSignatureValidity *validity);
Gets the list of signers.
|
signature validity |
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. |