| Top |
| enum | GMimeCipherHash |
| struct | GMimeCipherContext |
| struct | GMimeSignatureValidity |
| enum | GMimeSignatureStatus |
| enum | GMimeSignerStatus |
| enum | GMimeSignerTrust |
| enum | GMimeSignerError |
| struct | GMimeSigner |
A GMimeCipherContext is used for encrypting, decrypting, signing and verifying cryptographic signatures.
GMimeCipherHash g_mime_cipher_context_hash_id (GMimeCipherContext *ctx,const char *hash);
Gets the hash id based on the hash name hash
.
const char * g_mime_cipher_context_hash_name (GMimeCipherContext *ctx,GMimeCipherHash hash);
Gets the hash name based on the hash id hash
.
int g_mime_cipher_context_sign (GMimeCipherContext *ctx,const char *userid,GMimeCipherHash hash,GMimeStream *istream,GMimeStream *ostream,GError **err);
Signs the input stream and writes the resulting signature to the output stream.
ctx |
||
userid |
private key to use to sign the stream |
|
hash |
preferred Message-Integrity-Check hash algorithm |
|
istream |
input stream |
|
ostream |
output stream |
|
err |
a GError |
the GMimeCipherHash used on success (useful if hash
is
specified as GMIME_CIPHER_HASH_DEFAULT) or -1 on fail.
GMimeSignatureValidity * g_mime_cipher_context_verify (GMimeCipherContext *ctx,GMimeCipherHash 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 |
||
hash |
secure hash used |
|
istream |
input stream |
|
sigstream |
optional detached-signature stream |
|
err |
a GError |
a GMimeSignatureValidity structure containing information
about the integrity of the input stream or NULL on failure to
execute at all.
int g_mime_cipher_context_encrypt (GMimeCipherContext *ctx,gboolean sign,const char *userid,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.
GMimeSignatureValidity * g_mime_cipher_context_decrypt (GMimeCipherContext *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 have signer information included and the signature status will be one of GMIME_SIGNATURE_STATUS_GOOD, GMIME_SIGNATURE_STATUS_BAD, or GMIME_SIGNATURE_STATUS_UNKNOWN.
If the encrypted input text was not signed, then the signature status of the returned GMimeSignatureValidity will be GMIME_SIGNATURE_STATUS_NONE.
int g_mime_cipher_context_import_keys (GMimeCipherContext *ctx,GMimeStream *istream,GError **err);
Imports a stream of keys/certificates contained within istream
into the key/certificate database controlled by ctx
.
int g_mime_cipher_context_export_keys (GMimeCipherContext *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
.
void
g_mime_signer_free (GMimeSigner *signer);
Frees a singleton signer. Should NOT be used to free signers
returned from g_mime_signature_validity_get_signers().
GMimeSigner *
g_mime_signer_next (GMimeSigner *signer);
Advance to the next signer.
GMimeSignerStatus
g_mime_signer_get_status (const GMimeSigner *signer);
Get the signer status.
void g_mime_signer_set_status (GMimeSigner *signer,GMimeSignerStatus status);
Set the status on the signer.
GMimeSignerError
g_mime_signer_get_errors (const GMimeSigner *signer);
Get the signer errors.
void g_mime_signer_set_errors (GMimeSigner *signer,GMimeSignerError error);
Set the errors on the signer.
GMimeSignerTrust
g_mime_signer_get_trust (const GMimeSigner *signer);
Get the signer trust.
void g_mime_signer_set_trust (GMimeSigner *signer,GMimeSignerTrust trust);
Set the signer trust.
const char *
g_mime_signer_get_fingerprint (const GMimeSigner *signer);
Get the signer's key fingerprint.
void g_mime_signer_set_fingerprint (GMimeSigner *signer,const char *fingerprint);
Set the signer's key fingerprint.
const char *
g_mime_signer_get_key_id (const GMimeSigner *signer);
Get the signer's key id.
void g_mime_signer_set_key_id (GMimeSigner *signer,const char *key_id);
Set the signer's key id.
const char *
g_mime_signer_get_name (const GMimeSigner *signer);
Get the signer's name.
void g_mime_signer_set_name (GMimeSigner *signer,const char *name);
Set the signer's name.
time_t
g_mime_signer_get_created (const GMimeSigner *signer);
Get the creation date of the signer's key.
void g_mime_signer_set_created (GMimeSigner *signer,time_t created);
Set the signer's key creation date.
time_t
g_mime_signer_get_expires (const GMimeSigner *signer);
Get the expiration date of the signer's key.
void g_mime_signer_set_expires (GMimeSigner *signer,time_t expires);
Set the signer's key expiration date.
GMimeSignatureValidity *
g_mime_signature_validity_new (void);
Creates a new GMimeSignatureValidity.
void
g_mime_signature_validity_free (GMimeSignatureValidity *validity);
Frees the memory used by validity
back to the system.
void g_mime_signature_validity_set_status (GMimeSignatureValidity *validity,GMimeSignatureStatus status);
Sets the status of the signature on validity
.
GMimeSignatureStatus
g_mime_signature_validity_get_status (const GMimeSignatureValidity *validity);
Gets the signature status (GOOD, BAD, UNKNOWN).
void g_mime_signature_validity_set_details (GMimeSignatureValidity *validity,const char *details);
Sets details
as the status details string on validity
.
const char *
g_mime_signature_validity_get_details (const GMimeSignatureValidity *validity);
Gets any user-readable status details.
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.
const GMimeSigner *
g_mime_signature_validity_get_signers (const GMimeSignatureValidity *validity);
Gets the list of signers.
a GMimeSigner list which contain further information such as trust and cipher keys. These signers are part of the GMimeSignatureValidity and should NOT be freed individually.
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 HAVAL5-160 hash algorithm. |
struct GMimeSignatureValidity {
GMimeSignatureStatus status;
GMimeSigner *signers;
char *details;
};
A structure containing information about the signature validity of a signed stream.
GMimeSignatureStatus |
The overall signature status. |
|
GMimeSigner * |
A list of GMimeSigner structures. |
|
A string containing more user-readable details. |
The trust value of a signer.
struct GMimeSigner {
GMimeSigner *next;
unsigned int status:2; /* GMimeSignerStatus */
unsigned int errors:4; /* bitfield of GMimeSignerError's */
unsigned int trust:3; /* GMimeSignerTrust */
unsigned int unused:23; /* unused expansion bits */
char *fingerprint;
time_t created;
time_t expires;
char *keyid;
char *name;
};
A structure containing useful information about a signer.
GMimeSigner * |
Pointer to the next GMimeSigner. |
|
A bitfield of GMimeSignerError values. |
||
Unused expansion bits for future use; ignore this. |
||
A hex string representing the signer's fingerprint. |
||
The creation date of the signature. |
||
The expiration date of the signature. |
||
The signer's key id. |
||
The name of the person or entity. |