| GMime 2.6 Reference Manual | ||||
|---|---|---|---|---|
| Top | Description | Object Hierarchy | ||||
gboolean (*GMimePasswordRequestFunc) (GMimeCryptoContext *ctx,const char *user_id,const char *prompt_ctx,gboolean reprompt,GMimeStream *response,GError **err); 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); GMimeDigestAlgo g_mime_crypto_context_digest_id (GMimeCryptoContext *ctx,const char *name); const char * g_mime_crypto_context_digest_name (GMimeCryptoContext *ctx,GMimeDigestAlgo digest); int g_mime_crypto_context_sign (GMimeCryptoContext *ctx,const char *userid,GMimeDigestAlgo digest,GMimeStream *istream,GMimeStream *ostream,GError **err); GMimeSignatureList * g_mime_crypto_context_verify (GMimeCryptoContext *ctx,GMimeDigestAlgo digest,GMimeStream *istream,GMimeStream *sigstream,GError **err); int g_mime_crypto_context_encrypt (GMimeCryptoContext *ctx,gboolean sign,const char *userid,GMimeDigestAlgo digest,GPtrArray *recipients,GMimeStream *istream,GMimeStream *ostream,GError **err); GMimeDecryptResult * 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 GMimeCipherAlgo; GMimeDecryptResult; GMimeDecryptResult * g_mime_decrypt_result_new (void); GMimeCertificateList * g_mime_decrypt_result_get_recipients (GMimeDecryptResult *result); void g_mime_decrypt_result_set_recipients (GMimeDecryptResult *result,GMimeCertificateList *recipients); GMimeSignatureList * g_mime_decrypt_result_get_signatures (GMimeDecryptResult *result); void g_mime_decrypt_result_set_signatures (GMimeDecryptResult *result,GMimeSignatureList *signatures); GMimeCipherAlgo g_mime_decrypt_result_get_cipher (GMimeDecryptResult *result); void g_mime_decrypt_result_set_cipher (GMimeDecryptResult *result,GMimeCipherAlgo cipher); GMimeDigestAlgo g_mime_decrypt_result_get_mdc (GMimeDecryptResult *result); void g_mime_decrypt_result_set_mdc (GMimeDecryptResult *result,GMimeDigestAlgo mdc);
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 struct _GMimeCryptoContext GMimeCryptoContext;
A crypto context for use with MIME.
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 |
const char * g_mime_crypto_context_get_signature_protocol
(GMimeCryptoContext *ctx);
Gets the signature protocol for the crypto context.
|
a GMimeCryptoContext |
Returns : |
the signature protocol or NULL if not supported.
|
const char * g_mime_crypto_context_get_encryption_protocol
(GMimeCryptoContext *ctx);
Gets the encryption protocol for the crypto context.
|
a GMimeCryptoContext |
Returns : |
the encryption protocol or NULL if not supported.
|
const char * g_mime_crypto_context_get_key_exchange_protocol
(GMimeCryptoContext *ctx);
Gets the key exchange protocol for the crypto context.
|
a GMimeCryptoContext |
Returns : |
the key exchange protocol or NULL if not supported.
|
GMimeDigestAlgo g_mime_crypto_context_digest_id (GMimeCryptoContext *ctx,const char *name);
Gets the digest id based on the digest name.
|
a GMimeCryptoContext |
|
digest name |
Returns : |
the equivalent digest id or GMIME_DIGEST_ALGO_DEFAULT on fail. |
const char * g_mime_crypto_context_digest_name (GMimeCryptoContext *ctx,GMimeDigestAlgo digest);
Gets the digest name based on the digest id digest.
|
a GMimeCryptoContext |
|
digest id |
Returns : |
the equivalent digest name or NULL on fail.
|
int g_mime_crypto_context_sign (GMimeCryptoContext *ctx,const char *userid,GMimeDigestAlgo digest,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 GMimeDigestAlgo used on success (useful if digest is
specified as GMIME_DIGEST_ALGO_DEFAULT) or -1 on fail.
|
GMimeSignatureList * g_mime_crypto_context_verify (GMimeCryptoContext *ctx,GMimeDigestAlgo digest,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 GMimeSignatureList object containing the status of each signature. |
int g_mime_crypto_context_encrypt (GMimeCryptoContext *ctx,gboolean sign,const char *userid,GMimeDigestAlgo digest,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.
|
GMimeDecryptResult * 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
GMimeDecryptResult will have a non-NULL list of signatures, each with a
GMimeSignatureStatus (among other details about each signature).
On success, the returned GMimeDecryptResult will contain a list of certificates, one for each recipient, that the original encrypted stream was encrypted to.
|
a GMimeCryptoContext |
|
input/ciphertext stream |
|
output/cleartext stream |
|
a GError |
Returns : |
a GMimeDecryptResult 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.
|
typedef enum {
GMIME_CIPHER_ALGO_DEFAULT = 0,
GMIME_CIPHER_ALGO_IDEA = 1,
GMIME_CIPHER_ALGO_3DES = 2,
GMIME_CIPHER_ALGO_CAST5 = 3,
GMIME_CIPHER_ALGO_BLOWFISH = 4,
GMIME_CIPHER_ALGO_AES = 7,
GMIME_CIPHER_ALGO_AES192 = 8,
GMIME_CIPHER_ALGO_AES256 = 9,
GMIME_CIPHER_ALGO_TWOFISH = 10,
GMIME_CIPHER_ALGO_CAMELLIA128 = 11,
GMIME_CIPHER_ALGO_CAMELLIA196 = 12,
GMIME_CIPHER_ALGO_CAMELLIA256 = 13
} GMimeCipherAlgo;
A cipher algorithm.
| The default (or unknown) cipher. | |
| The IDEA cipher. | |
| The 3DES cipher. | |
| The CAST5 cipher. | |
| The Blowfish cipher. | |
| The AES (aka RIJANDALE) cipher. | |
| The AES-192 cipher. | |
| The AES-256 cipher. | |
| The Twofish cipher. | |
| The Camellia-128 cipher. | |
| The Camellia-196 cipher. | |
| The Camellia-256 cipher. |
typedef struct {
GObject parent_object;
GMimeCertificateList *recipients;
GMimeSignatureList *signatures;
GMimeCipherAlgo cipher;
GMimeDigestAlgo mdc;
} GMimeDecryptResult;
An object containing the results from decrypting an encrypted stream.
GObject |
parent GObject |
GMimeCertificateList * |
A GMimeCertificateList |
GMimeSignatureList * |
A GMimeSignatureList if signed or NULL otherwise.
|
GMimeCipherAlgo |
The cipher algorithm used to encrypt the stream. |
GMimeDigestAlgo |
The MDC digest algorithm used, if any. |
GMimeDecryptResult * g_mime_decrypt_result_new (void);
Creates a new GMimeDecryptResult object.
Returns : |
a new GMimeDecryptResult object. |
GMimeCertificateList * g_mime_decrypt_result_get_recipients
(GMimeDecryptResult *result);
Gets the list of certificates that the stream had been encrypted to.
|
A GMimeDecryptResult |
Returns : |
a GMimeCertificateList. |
void g_mime_decrypt_result_set_recipients (GMimeDecryptResult *result,GMimeCertificateList *recipients);
Sets the list of certificates that the stream had been encrypted to.
|
A GMimeDecryptResult |
|
A GMimeCertificateList |
GMimeSignatureList * g_mime_decrypt_result_get_signatures
(GMimeDecryptResult *result);
Gets a list of signatures if the encrypted stream had also been signed.
|
A GMimeDecryptResult |
Returns : |
a GMimeSignatureList or NULL if the stream was not signed.
|
void g_mime_decrypt_result_set_signatures (GMimeDecryptResult *result,GMimeSignatureList *signatures);
Sets the list of signatures.
|
A GMimeDecryptResult |
|
A GMimeSignatureList |
GMimeCipherAlgo g_mime_decrypt_result_get_cipher (GMimeDecryptResult *result);
Get the cipher algorithm used.
|
a GMimeDecryptResult |
Returns : |
the cipher algorithm used. |
void g_mime_decrypt_result_set_cipher (GMimeDecryptResult *result,GMimeCipherAlgo cipher);
Set the cipher algorithm used.
|
a GMimeDecryptResult |
|
a GMimeCipherAlgo |
GMimeDigestAlgo g_mime_decrypt_result_get_mdc (GMimeDecryptResult *result);
Get the mdc digest algorithm used.
|
a GMimeDecryptResult |
Returns : |
the mdc digest algorithm used. |
void g_mime_decrypt_result_set_mdc (GMimeDecryptResult *result,GMimeDigestAlgo mdc);
Set the mdc digest algorithm used.
|
a GMimeDecryptResult |
|
a GMimeDigestAlgo |