<refentry id="camel-CamelCipherContext">
<refmeta>
<refentrytitle role="top_of_page" id="camel-CamelCipherContext.top_of_page">CamelCipherContext</refentrytitle>
<manvolnum>3</manvolnum>
<refmiscinfo>CAMEL Library</refmiscinfo>
</refmeta>

<refnamediv>
<refname>CamelCipherContext</refname>
<refpurpose></refpurpose>
<!--[<xref linkend="desc" endterm="desc.title"/>]-->
</refnamediv>

<refsynopsisdiv id="camel-CamelCipherContext.synopsis" role="synopsis">
<title role="synopsis.title">Synopsis</title>

<synopsis>
                    <link linkend="CamelCipherContext">CamelCipherContext</link>;
                    <link linkend="CamelCipherValidity">CamelCipherValidity</link>;
                    <link linkend="CamelCipherCertInfo">CamelCipherCertInfo</link>;
enum                <link linkend="CamelCipherHash">CamelCipherHash</link>;
enum                <link linkend="camel-cipher-validity-sign-t">camel_cipher_validity_sign_t</link>;
enum                <link linkend="camel-cipher-validity-encrypt-t">camel_cipher_validity_encrypt_t</link>;
enum                <link linkend="camel-cipher-validity-mode-t">camel_cipher_validity_mode_t</link>;
<link linkend="CamelCipherContext">CamelCipherContext</link>* <link linkend="camel-cipher-context-new">camel_cipher_context_new</link>            (<link linkend="CamelSession">CamelSession</link> *session);
<link linkend="void">void</link>                <link linkend="camel-cipher-context-construct">camel_cipher_context_construct</link>      (<link linkend="CamelCipherContext">CamelCipherContext</link> *context,
                                                         <link linkend="CamelSession">CamelSession</link> *session);
<link linkend="CamelCipherHash">CamelCipherHash</link>     <link linkend="camel-cipher-id-to-hash">camel_cipher_id_to_hash</link>             (<link linkend="CamelCipherContext">CamelCipherContext</link> *context,
                                                         const <link linkend="char">char</link> *id);
const <link linkend="char">char</link>*         <link linkend="camel-cipher-hash-to-id">camel_cipher_hash_to_id</link>             (<link linkend="CamelCipherContext">CamelCipherContext</link> *context,
                                                         <link linkend="CamelCipherHash">CamelCipherHash</link> hash);
<link linkend="int">int</link>                 <link linkend="camel-cipher-sign">camel_cipher_sign</link>                   (<link linkend="CamelCipherContext">CamelCipherContext</link> *context,
                                                         const <link linkend="char">char</link> *userid,
                                                         <link linkend="CamelCipherHash">CamelCipherHash</link> hash,
                                                         <link linkend="struct--CamelMimePart">struct _CamelMimePart</link> *ipart,
                                                         <link linkend="struct--CamelMimePart">struct _CamelMimePart</link> *opart,
                                                         <link linkend="CamelException">CamelException</link> *ex);
<link linkend="CamelCipherValidity">CamelCipherValidity</link>* <link linkend="camel-cipher-verify">camel_cipher_verify</link>                (<link linkend="CamelCipherContext">CamelCipherContext</link> *context,
                                                         <link linkend="struct--CamelMimePart">struct _CamelMimePart</link> *ipart,
                                                         <link linkend="CamelException">CamelException</link> *ex);
<link linkend="int">int</link>                 <link linkend="camel-cipher-encrypt">camel_cipher_encrypt</link>                (<link linkend="CamelCipherContext">CamelCipherContext</link> *context,
                                                         const <link linkend="char">char</link> *userid,
                                                         <link linkend="GPtrArray">GPtrArray</link> *recipients,
                                                         <link linkend="struct--CamelMimePart">struct _CamelMimePart</link> *ipart,
                                                         <link linkend="struct--CamelMimePart">struct _CamelMimePart</link> *opart,
                                                         <link linkend="CamelException">CamelException</link> *ex);
<link linkend="CamelCipherValidity">CamelCipherValidity</link>* <link linkend="camel-cipher-decrypt">camel_cipher_decrypt</link>               (<link linkend="CamelCipherContext">CamelCipherContext</link> *context,
                                                         <link linkend="struct--CamelMimePart">struct _CamelMimePart</link> *ipart,
                                                         <link linkend="struct--CamelMimePart">struct _CamelMimePart</link> *opart,
                                                         <link linkend="CamelException">CamelException</link> *ex);
<link linkend="int">int</link>                 <link linkend="camel-cipher-import-keys">camel_cipher_import_keys</link>            (<link linkend="CamelCipherContext">CamelCipherContext</link> *context,
                                                         <link linkend="struct--CamelStream">struct _CamelStream</link> *istream,
                                                         <link linkend="CamelException">CamelException</link> *ex);
<link linkend="int">int</link>                 <link linkend="camel-cipher-export-keys">camel_cipher_export_keys</link>            (<link linkend="CamelCipherContext">CamelCipherContext</link> *context,
                                                         <link linkend="GPtrArray">GPtrArray</link> *keys,
                                                         <link linkend="struct--CamelStream">struct _CamelStream</link> *ostream,
                                                         <link linkend="CamelException">CamelException</link> *ex);
<link linkend="CamelCipherValidity">CamelCipherValidity</link>* <link linkend="camel-cipher-validity-new">camel_cipher_validity_new</link>          (void);
<link linkend="void">void</link>                <link linkend="camel-cipher-validity-init">camel_cipher_validity_init</link>          (<link linkend="CamelCipherValidity">CamelCipherValidity</link> *validity);
<link linkend="gboolean">gboolean</link>            <link linkend="camel-cipher-validity-get-valid">camel_cipher_validity_get_valid</link>     (<link linkend="CamelCipherValidity">CamelCipherValidity</link> *validity);
<link linkend="void">void</link>                <link linkend="camel-cipher-validity-set-valid">camel_cipher_validity_set_valid</link>     (<link linkend="CamelCipherValidity">CamelCipherValidity</link> *validity,
                                                         <link linkend="gboolean">gboolean</link> valid);
<link linkend="char">char</link>*               <link linkend="camel-cipher-validity-get-description">camel_cipher_validity_get_description</link>
                                                        (<link linkend="CamelCipherValidity">CamelCipherValidity</link> *validity);
<link linkend="void">void</link>                <link linkend="camel-cipher-validity-set-description">camel_cipher_validity_set_description</link>
                                                        (<link linkend="CamelCipherValidity">CamelCipherValidity</link> *validity,
                                                         const <link linkend="char">char</link> *description);
<link linkend="void">void</link>                <link linkend="camel-cipher-validity-clear">camel_cipher_validity_clear</link>         (<link linkend="CamelCipherValidity">CamelCipherValidity</link> *validity);
<link linkend="CamelCipherValidity">CamelCipherValidity</link>* <link linkend="camel-cipher-validity-clone">camel_cipher_validity_clone</link>        (<link linkend="CamelCipherValidity">CamelCipherValidity</link> *vin);
<link linkend="void">void</link>                <link linkend="camel-cipher-validity-add-certinfo">camel_cipher_validity_add_certinfo</link>  (<link linkend="CamelCipherValidity">CamelCipherValidity</link> *vin,
                                                         <link linkend="camel-cipher-validity-mode-t">camel_cipher_validity_mode_t</link> mode,
                                                         const <link linkend="char">char</link> *name,
                                                         const <link linkend="char">char</link> *email);
<link linkend="void">void</link>                <link linkend="camel-cipher-validity-envelope">camel_cipher_validity_envelope</link>      (<link linkend="CamelCipherValidity">CamelCipherValidity</link> *valid,
                                                         <link linkend="CamelCipherValidity">CamelCipherValidity</link> *outer);
<link linkend="void">void</link>                <link linkend="camel-cipher-validity-free">camel_cipher_validity_free</link>          (<link linkend="CamelCipherValidity">CamelCipherValidity</link> *validity);
<link linkend="int">int</link>                 <link linkend="camel-cipher-canonical-to-stream">camel_cipher_canonical_to_stream</link>    (<link linkend="CamelMimePart">CamelMimePart</link> *part,
                                                         <link linkend="guint32">guint32</link> flags,
                                                         <link linkend="CamelStream">CamelStream</link> *ostream);
</synopsis>
</refsynopsisdiv>









<refsect1 id="camel-CamelCipherContext.description" role="desc">
<title role="desc.title">Description</title>
<para>

</para>
</refsect1>

<refsect1 id="camel-CamelCipherContext.details" role="details">
<title role="details.title">Details</title>
<refsect2 id="CamelCipherContext" role="struct">
<title>CamelCipherContext</title>
<indexterm zone="CamelCipherContext"><primary>CamelCipherContext</primary></indexterm><programlisting>typedef struct {
	CamelObject parent_object;
	
	struct _CamelCipherContextPrivate *priv;
	
	CamelSession *session;
	
	/* these MUST be set by implementors */
	const char *sign_protocol;
	const char *encrypt_protocol;
	const char *key_protocol;
} CamelCipherContext;
</programlisting>
<para>

</para></refsect2>
<refsect2 id="CamelCipherValidity" role="struct">
<title>CamelCipherValidity</title>
<indexterm zone="CamelCipherValidity"><primary>CamelCipherValidity</primary></indexterm><programlisting>typedef struct {
	struct _CamelCipherValidity *next;
	struct _CamelCipherValidity *prev;
	EDList children;

	struct {
		enum _camel_cipher_validity_sign_t status;
		char *description;
		EDList signers;	/* CamelCipherCertInfo's */
	} sign;
	struct {
		enum _camel_cipher_validity_encrypt_t status;
		char *description;
		EDList encrypters;	/* CamelCipherCertInfo's */
	} encrypt;
} CamelCipherValidity;
</programlisting>
<para>

</para></refsect2>
<refsect2 id="CamelCipherCertInfo" role="struct">
<title>CamelCipherCertInfo</title>
<indexterm zone="CamelCipherCertInfo"><primary>CamelCipherCertInfo</primary></indexterm><programlisting>typedef struct {
	struct _CamelCipherCertInfo *next;
	struct _CamelCipherCertInfo *prev;

	char *name;		/* common name */
	char *email;
} CamelCipherCertInfo;
</programlisting>
<para>

</para></refsect2>
<refsect2 id="CamelCipherHash" role="enum">
<title>enum CamelCipherHash</title>
<indexterm zone="CamelCipherHash"><primary>CamelCipherHash</primary></indexterm><programlisting>typedef enum {
	CAMEL_CIPHER_HASH_DEFAULT,
	CAMEL_CIPHER_HASH_MD2,
	CAMEL_CIPHER_HASH_MD5,
	CAMEL_CIPHER_HASH_SHA1,
	CAMEL_CIPHER_HASH_RIPEMD160,
	CAMEL_CIPHER_HASH_TIGER192,
	CAMEL_CIPHER_HASH_HAVAL5160
} CamelCipherHash;
</programlisting>
<para>

</para></refsect2>
<refsect2 id="camel-cipher-validity-sign-t" role="enum">
<title>enum camel_cipher_validity_sign_t</title>
<indexterm zone="camel-cipher-validity-sign-t"><primary>camel_cipher_validity_sign_t</primary></indexterm><programlisting>typedef enum _camel_cipher_validity_sign_t {
	CAMEL_CIPHER_VALIDITY_SIGN_NONE,
	CAMEL_CIPHER_VALIDITY_SIGN_GOOD,
	CAMEL_CIPHER_VALIDITY_SIGN_BAD,
	CAMEL_CIPHER_VALIDITY_SIGN_UNKNOWN,
	CAMEL_CIPHER_VALIDITY_SIGN_NEED_PUBLIC_KEY
} camel_cipher_validity_sign_t;
</programlisting>
<para>

</para></refsect2>
<refsect2 id="camel-cipher-validity-encrypt-t" role="enum">
<title>enum camel_cipher_validity_encrypt_t</title>
<indexterm zone="camel-cipher-validity-encrypt-t"><primary>camel_cipher_validity_encrypt_t</primary></indexterm><programlisting>typedef enum _camel_cipher_validity_encrypt_t {
	CAMEL_CIPHER_VALIDITY_ENCRYPT_NONE,
	CAMEL_CIPHER_VALIDITY_ENCRYPT_WEAK,
	CAMEL_CIPHER_VALIDITY_ENCRYPT_ENCRYPTED, /* encrypted, unknown strenght */
	CAMEL_CIPHER_VALIDITY_ENCRYPT_STRONG
} camel_cipher_validity_encrypt_t;
</programlisting>
<para>

</para></refsect2>
<refsect2 id="camel-cipher-validity-mode-t" role="enum">
<title>enum camel_cipher_validity_mode_t</title>
<indexterm zone="camel-cipher-validity-mode-t"><primary>camel_cipher_validity_mode_t</primary></indexterm><programlisting>typedef enum _camel_cipher_validity_mode_t {
	CAMEL_CIPHER_VALIDITY_SIGN,
	CAMEL_CIPHER_VALIDITY_ENCRYPT
} camel_cipher_validity_mode_t;
</programlisting>
<para>

</para></refsect2>
<refsect2 id="camel-cipher-context-new" role="function">
<title>camel_cipher_context_new ()</title>
<indexterm zone="camel-cipher-context-new"><primary>camel_cipher_context_new</primary></indexterm><programlisting><link linkend="CamelCipherContext">CamelCipherContext</link>* camel_cipher_context_new            (<link linkend="CamelSession">CamelSession</link> *session);</programlisting>
<para>
This creates a new CamelCipherContext object which is used to sign,
verify, encrypt and decrypt streams.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>session</parameter>&nbsp;:</term>
<listitem><simpara> CamelSession
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> the new CamelCipherContext
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="camel-cipher-context-construct" role="function">
<title>camel_cipher_context_construct ()</title>
<indexterm zone="camel-cipher-context-construct"><primary>camel_cipher_context_construct</primary></indexterm><programlisting><link linkend="void">void</link>                camel_cipher_context_construct      (<link linkend="CamelCipherContext">CamelCipherContext</link> *context,
                                                         <link linkend="CamelSession">CamelSession</link> *session);</programlisting>
<para>
Constucts the CamelCipherContext</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>context</parameter>&nbsp;:</term>
<listitem><simpara> CamelCipherContext
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>session</parameter>&nbsp;:</term>
<listitem><simpara> CamelSession
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="camel-cipher-id-to-hash" role="function">
<title>camel_cipher_id_to_hash ()</title>
<indexterm zone="camel-cipher-id-to-hash"><primary>camel_cipher_id_to_hash</primary></indexterm><programlisting><link linkend="CamelCipherHash">CamelCipherHash</link>     camel_cipher_id_to_hash             (<link linkend="CamelCipherContext">CamelCipherContext</link> *context,
                                                         const <link linkend="char">char</link> *id);</programlisting>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>context</parameter>&nbsp;:</term>
<listitem><simpara>
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>id</parameter>&nbsp;:</term>
<listitem><simpara>
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara>


</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="camel-cipher-hash-to-id" role="function">
<title>camel_cipher_hash_to_id ()</title>
<indexterm zone="camel-cipher-hash-to-id"><primary>camel_cipher_hash_to_id</primary></indexterm><programlisting>const <link linkend="char">char</link>*         camel_cipher_hash_to_id             (<link linkend="CamelCipherContext">CamelCipherContext</link> *context,
                                                         <link linkend="CamelCipherHash">CamelCipherHash</link> hash);</programlisting>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>context</parameter>&nbsp;:</term>
<listitem><simpara>
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>hash</parameter>&nbsp;:</term>
<listitem><simpara>
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara>


</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="camel-cipher-sign" role="function">
<title>camel_cipher_sign ()</title>
<indexterm zone="camel-cipher-sign"><primary>camel_cipher_sign</primary></indexterm><programlisting><link linkend="int">int</link>                 camel_cipher_sign                   (<link linkend="CamelCipherContext">CamelCipherContext</link> *context,
                                                         const <link linkend="char">char</link> *userid,
                                                         <link linkend="CamelCipherHash">CamelCipherHash</link> hash,
                                                         <link linkend="struct--CamelMimePart">struct _CamelMimePart</link> *ipart,
                                                         <link linkend="struct--CamelMimePart">struct _CamelMimePart</link> *opart,
                                                         <link linkend="CamelException">CamelException</link> *ex);</programlisting>
<para>
Converts the (unsigned) part <parameter>ipart</parameter> into a new self-contained mime part <parameter>opart</parameter>.
This may be a multipart/signed part, or a simple part for enveloped types.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>context</parameter>&nbsp;:</term>
<listitem><simpara> Cipher Context
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>userid</parameter>&nbsp;:</term>
<listitem><simpara> private key to use to sign the stream
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>hash</parameter>&nbsp;:</term>
<listitem><simpara> preferred Message-Integrity-Check hash algorithm
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>ipart</parameter>&nbsp;:</term>
<listitem><simpara> Input part.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>opart</parameter>&nbsp;:</term>
<listitem><simpara> output part.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>ex</parameter>&nbsp;:</term>
<listitem><simpara> exception
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> 0 for success or -1 for failure.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="camel-cipher-verify" role="function">
<title>camel_cipher_verify ()</title>
<indexterm zone="camel-cipher-verify"><primary>camel_cipher_verify</primary></indexterm><programlisting><link linkend="CamelCipherValidity">CamelCipherValidity</link>* camel_cipher_verify                (<link linkend="CamelCipherContext">CamelCipherContext</link> *context,
                                                         <link linkend="struct--CamelMimePart">struct _CamelMimePart</link> *ipart,
                                                         <link linkend="CamelException">CamelException</link> *ex);</programlisting>
<para>
Verifies the signature. If <parameter>istream</parameter> is a clearsigned stream,
you should pass <link linkend="NULL:CAPS"><literal>NULL</literal></link> as the sigstream parameter. Otherwise
<parameter>sigstream</parameter> is assumed to be the signature stream and is used to
verify the integirity of the <parameter>istream</parameter>.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>context</parameter>&nbsp;:</term>
<listitem><simpara> Cipher Context
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>ipart</parameter>&nbsp;:</term>
<listitem><simpara> part to verify
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>ex</parameter>&nbsp;:</term>
<listitem><simpara> exception
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> a CamelCipherValidity structure containing information
about the integrity of the input stream or <link linkend="NULL:CAPS"><literal>NULL</literal></link> on failure to
execute at all.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="camel-cipher-encrypt" role="function">
<title>camel_cipher_encrypt ()</title>
<indexterm zone="camel-cipher-encrypt"><primary>camel_cipher_encrypt</primary></indexterm><programlisting><link linkend="int">int</link>                 camel_cipher_encrypt                (<link linkend="CamelCipherContext">CamelCipherContext</link> *context,
                                                         const <link linkend="char">char</link> *userid,
                                                         <link linkend="GPtrArray">GPtrArray</link> *recipients,
                                                         <link linkend="struct--CamelMimePart">struct _CamelMimePart</link> *ipart,
                                                         <link linkend="struct--CamelMimePart">struct _CamelMimePart</link> *opart,
                                                         <link linkend="CamelException">CamelException</link> *ex);</programlisting>
<para>
Encrypts (and optionally signs) the cleartext input stream and
writes the resulting ciphertext to the output stream.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>context</parameter>&nbsp;:</term>
<listitem><simpara> Cipher Context
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>userid</parameter>&nbsp;:</term>
<listitem><simpara> key id (or email address) to use when signing, or NULL to not sign.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>recipients</parameter>&nbsp;:</term>
<listitem><simpara> an array of recipient key ids and/or email addresses
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>ipart</parameter>&nbsp;:</term>
<listitem><simpara> cleartext input stream
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>opart</parameter>&nbsp;:</term>
<listitem><simpara> ciphertext output stream
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>ex</parameter>&nbsp;:</term>
<listitem><simpara> exception
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> 0 for success or -1 for failure.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="camel-cipher-decrypt" role="function">
<title>camel_cipher_decrypt ()</title>
<indexterm zone="camel-cipher-decrypt"><primary>camel_cipher_decrypt</primary></indexterm><programlisting><link linkend="CamelCipherValidity">CamelCipherValidity</link>* camel_cipher_decrypt               (<link linkend="CamelCipherContext">CamelCipherContext</link> *context,
                                                         <link linkend="struct--CamelMimePart">struct _CamelMimePart</link> *ipart,
                                                         <link linkend="struct--CamelMimePart">struct _CamelMimePart</link> *opart,
                                                         <link linkend="CamelException">CamelException</link> *ex);</programlisting>
<para>
Decrypts <parameter>ipart</parameter> into <parameter>opart</parameter>.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>context</parameter>&nbsp;:</term>
<listitem><simpara> 
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>ipart</parameter>&nbsp;:</term>
<listitem><simpara> 
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>opart</parameter>&nbsp;:</term>
<listitem><simpara> 
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>ex</parameter>&nbsp;:</term>
<listitem><simpara> 
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> A validity/encryption status.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="camel-cipher-import-keys" role="function">
<title>camel_cipher_import_keys ()</title>
<indexterm zone="camel-cipher-import-keys"><primary>camel_cipher_import_keys</primary></indexterm><programlisting><link linkend="int">int</link>                 camel_cipher_import_keys            (<link linkend="CamelCipherContext">CamelCipherContext</link> *context,
                                                         <link linkend="struct--CamelStream">struct _CamelStream</link> *istream,
                                                         <link linkend="CamelException">CamelException</link> *ex);</programlisting>
<para>
Imports a stream of keys/certificates contained within <parameter>istream</parameter>
into the key/certificate database controlled by <parameter>ctx</parameter>.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>context</parameter>&nbsp;:</term>
<listitem><simpara> Cipher Context
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>istream</parameter>&nbsp;:</term>
<listitem><simpara> input stream (containing keys)
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>ex</parameter>&nbsp;:</term>
<listitem><simpara> exception
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara>0 on success or -1 on fail.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="camel-cipher-export-keys" role="function">
<title>camel_cipher_export_keys ()</title>
<indexterm zone="camel-cipher-export-keys"><primary>camel_cipher_export_keys</primary></indexterm><programlisting><link linkend="int">int</link>                 camel_cipher_export_keys            (<link linkend="CamelCipherContext">CamelCipherContext</link> *context,
                                                         <link linkend="GPtrArray">GPtrArray</link> *keys,
                                                         <link linkend="struct--CamelStream">struct _CamelStream</link> *ostream,
                                                         <link linkend="CamelException">CamelException</link> *ex);</programlisting>
<para>
Exports the keys/certificates in <parameter>keys</parameter> to the stream <parameter>ostream</parameter> from
the key/certificate database controlled by <parameter>ctx</parameter>.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>context</parameter>&nbsp;:</term>
<listitem><simpara> Cipher Context
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>keys</parameter>&nbsp;:</term>
<listitem><simpara> an array of key ids
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>ostream</parameter>&nbsp;:</term>
<listitem><simpara> output stream
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>ex</parameter>&nbsp;:</term>
<listitem><simpara> exception
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara>0 on success or -1 on fail.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="camel-cipher-validity-new" role="function">
<title>camel_cipher_validity_new ()</title>
<indexterm zone="camel-cipher-validity-new"><primary>camel_cipher_validity_new</primary></indexterm><programlisting><link linkend="CamelCipherValidity">CamelCipherValidity</link>* camel_cipher_validity_new          (void);</programlisting>
<para>

</para><variablelist role="params">
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara>


</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="camel-cipher-validity-init" role="function">
<title>camel_cipher_validity_init ()</title>
<indexterm zone="camel-cipher-validity-init"><primary>camel_cipher_validity_init</primary></indexterm><programlisting><link linkend="void">void</link>                camel_cipher_validity_init          (<link linkend="CamelCipherValidity">CamelCipherValidity</link> *validity);</programlisting>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>validity</parameter>&nbsp;:</term>
<listitem><simpara>


</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="camel-cipher-validity-get-valid" role="function">
<title>camel_cipher_validity_get_valid ()</title>
<indexterm zone="camel-cipher-validity-get-valid"><primary>camel_cipher_validity_get_valid</primary></indexterm><programlisting><link linkend="gboolean">gboolean</link>            camel_cipher_validity_get_valid     (<link linkend="CamelCipherValidity">CamelCipherValidity</link> *validity);</programlisting>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>validity</parameter>&nbsp;:</term>
<listitem><simpara>
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara>


</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="camel-cipher-validity-set-valid" role="function">
<title>camel_cipher_validity_set_valid ()</title>
<indexterm zone="camel-cipher-validity-set-valid"><primary>camel_cipher_validity_set_valid</primary></indexterm><programlisting><link linkend="void">void</link>                camel_cipher_validity_set_valid     (<link linkend="CamelCipherValidity">CamelCipherValidity</link> *validity,
                                                         <link linkend="gboolean">gboolean</link> valid);</programlisting>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>validity</parameter>&nbsp;:</term>
<listitem><simpara>
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>valid</parameter>&nbsp;:</term>
<listitem><simpara>


</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="camel-cipher-validity-get-description" role="function">
<title>camel_cipher_validity_get_description ()</title>
<indexterm zone="camel-cipher-validity-get-description"><primary>camel_cipher_validity_get_description</primary></indexterm><programlisting><link linkend="char">char</link>*               camel_cipher_validity_get_description
                                                        (<link linkend="CamelCipherValidity">CamelCipherValidity</link> *validity);</programlisting>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>validity</parameter>&nbsp;:</term>
<listitem><simpara>
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara>


</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="camel-cipher-validity-set-description" role="function">
<title>camel_cipher_validity_set_description ()</title>
<indexterm zone="camel-cipher-validity-set-description"><primary>camel_cipher_validity_set_description</primary></indexterm><programlisting><link linkend="void">void</link>                camel_cipher_validity_set_description
                                                        (<link linkend="CamelCipherValidity">CamelCipherValidity</link> *validity,
                                                         const <link linkend="char">char</link> *description);</programlisting>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>validity</parameter>&nbsp;:</term>
<listitem><simpara>
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>description</parameter>&nbsp;:</term>
<listitem><simpara>


</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="camel-cipher-validity-clear" role="function">
<title>camel_cipher_validity_clear ()</title>
<indexterm zone="camel-cipher-validity-clear"><primary>camel_cipher_validity_clear</primary></indexterm><programlisting><link linkend="void">void</link>                camel_cipher_validity_clear         (<link linkend="CamelCipherValidity">CamelCipherValidity</link> *validity);</programlisting>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>validity</parameter>&nbsp;:</term>
<listitem><simpara>


</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="camel-cipher-validity-clone" role="function">
<title>camel_cipher_validity_clone ()</title>
<indexterm zone="camel-cipher-validity-clone"><primary>camel_cipher_validity_clone</primary></indexterm><programlisting><link linkend="CamelCipherValidity">CamelCipherValidity</link>* camel_cipher_validity_clone        (<link linkend="CamelCipherValidity">CamelCipherValidity</link> *vin);</programlisting>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>vin</parameter>&nbsp;:</term>
<listitem><simpara>
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara>


</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="camel-cipher-validity-add-certinfo" role="function">
<title>camel_cipher_validity_add_certinfo ()</title>
<indexterm zone="camel-cipher-validity-add-certinfo"><primary>camel_cipher_validity_add_certinfo</primary></indexterm><programlisting><link linkend="void">void</link>                camel_cipher_validity_add_certinfo  (<link linkend="CamelCipherValidity">CamelCipherValidity</link> *vin,
                                                         <link linkend="camel-cipher-validity-mode-t">camel_cipher_validity_mode_t</link> mode,
                                                         const <link linkend="char">char</link> *name,
                                                         const <link linkend="char">char</link> *email);</programlisting>
<para>
Add a cert info to the signer or encrypter info.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>vin</parameter>&nbsp;:</term>
<listitem><simpara> 
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>mode</parameter>&nbsp;:</term>
<listitem><simpara> 
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>name</parameter>&nbsp;:</term>
<listitem><simpara> 
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>email</parameter>&nbsp;:</term>
<listitem><simpara> 
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="camel-cipher-validity-envelope" role="function">
<title>camel_cipher_validity_envelope ()</title>
<indexterm zone="camel-cipher-validity-envelope"><primary>camel_cipher_validity_envelope</primary></indexterm><programlisting><link linkend="void">void</link>                camel_cipher_validity_envelope      (<link linkend="CamelCipherValidity">CamelCipherValidity</link> *valid,
                                                         <link linkend="CamelCipherValidity">CamelCipherValidity</link> *outer);</programlisting>
<para>
Calculate a conglomerate validity based on wrapping one secure part inside
another one.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>valid</parameter>&nbsp;:</term>
<listitem><simpara>
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>outer</parameter>&nbsp;:</term>
<listitem><simpara>


</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="camel-cipher-validity-free" role="function">
<title>camel_cipher_validity_free ()</title>
<indexterm zone="camel-cipher-validity-free"><primary>camel_cipher_validity_free</primary></indexterm><programlisting><link linkend="void">void</link>                camel_cipher_validity_free          (<link linkend="CamelCipherValidity">CamelCipherValidity</link> *validity);</programlisting>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>validity</parameter>&nbsp;:</term>
<listitem><simpara>


</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="camel-cipher-canonical-to-stream" role="function">
<title>camel_cipher_canonical_to_stream ()</title>
<indexterm zone="camel-cipher-canonical-to-stream"><primary>camel_cipher_canonical_to_stream</primary></indexterm><programlisting><link linkend="int">int</link>                 camel_cipher_canonical_to_stream    (<link linkend="CamelMimePart">CamelMimePart</link> *part,
                                                         <link linkend="guint32">guint32</link> flags,
                                                         <link linkend="CamelStream">CamelStream</link> *ostream);</programlisting>
<para>
Writes a part to a stream in a canonicalised format, suitable for signing/encrypting.
</para>
<para>
The transfer encoding paramaters for the part may be changed by this function.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>part</parameter>&nbsp;:</term>
<listitem><simpara> Part to write.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>flags</parameter>&nbsp;:</term>
<listitem><simpara> flags for the canonicalisation filter (CamelMimeFilterCanon)
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>ostream</parameter>&nbsp;:</term>
<listitem><simpara> stream to write canonicalised output to.
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> -1 on error;
</simpara></listitem></varlistentry>
</variablelist></refsect2>

</refsect1>




</refentry>
