<refentry id="GMimeMultipartEncrypted">
<refmeta>
<refentrytitle role="top_of_page" id="GMimeMultipartEncrypted.top_of_page">GMimeMultipartEncrypted</refentrytitle>
<manvolnum>3</manvolnum>
<refmiscinfo>
  GMIME Library
</refmiscinfo>
</refmeta>
<refnamediv>
<refname>GMimeMultipartEncrypted</refname>
<refpurpose>Encrypted MIME multiparts</refpurpose>
</refnamediv>

<refsynopsisdiv id="GMimeMultipartEncrypted.synopsis" role="synopsis">
<title role="synopsis.title">Synopsis</title>

<synopsis>                    <link linkend="GMimeMultipartEncrypted-struct">GMimeMultipartEncrypted</link>;
<link linkend="GMimeMultipartEncrypted"><returnvalue>GMimeMultipartEncrypted</returnvalue></link> * <link linkend="g-mime-multipart-encrypted-new">g_mime_multipart_encrypted_new</link>
                                                        (<parameter><type>void</type></parameter>);
<link linkend="int"><returnvalue>int</returnvalue></link>                 <link linkend="g-mime-multipart-encrypted-encrypt">g_mime_multipart_encrypted_encrypt</link>  (<parameter><link linkend="GMimeMultipartEncrypted"><type>GMimeMultipartEncrypted</type></link> *mpe</parameter>,
                                                         <parameter><link linkend="GMimeObject"><type>GMimeObject</type></link> *content</parameter>,
                                                         <parameter><link linkend="GMimeCryptoContext"><type>GMimeCryptoContext</type></link> *ctx</parameter>,
                                                         <parameter><link linkend="gboolean"><type>gboolean</type></link> sign</parameter>,
                                                         <parameter>const <link linkend="char"><type>char</type></link> *userid</parameter>,
                                                         <parameter><link linkend="GMimeDigestAlgo"><type>GMimeDigestAlgo</type></link> digest</parameter>,
                                                         <parameter><link linkend="GPtrArray"><type>GPtrArray</type></link> *recipients</parameter>,
                                                         <parameter><link linkend="GError"><type>GError</type></link> **err</parameter>);
<link linkend="GMimeObject"><returnvalue>GMimeObject</returnvalue></link> *       <link linkend="g-mime-multipart-encrypted-decrypt">g_mime_multipart_encrypted_decrypt</link>  (<parameter><link linkend="GMimeMultipartEncrypted"><type>GMimeMultipartEncrypted</type></link> *mpe</parameter>,
                                                         <parameter><link linkend="GMimeCryptoContext"><type>GMimeCryptoContext</type></link> *ctx</parameter>,
                                                         <parameter><link linkend="GMimeDecryptResult"><type>GMimeDecryptResult</type></link> **result</parameter>,
                                                         <parameter><link linkend="GError"><type>GError</type></link> **err</parameter>);
</synopsis>
</refsynopsisdiv>
<refsect1 id="GMimeMultipartEncrypted.object-hierarchy" role="object_hierarchy">
<title role="object_hierarchy.title">Object Hierarchy</title>
<synopsis>
  <link linkend="GObject">GObject</link>
   +----<link linkend="GMimeObject">GMimeObject</link>
         +----<link linkend="GMimeMultipart">GMimeMultipart</link>
               +----GMimeMultipartEncrypted
</synopsis>
</refsect1>

<refsect1 id="GMimeMultipartEncrypted.description" role="desc">
<title role="desc.title">Description</title>
<para>
A <link linkend="GMimeMultipartEncrypted"><type>GMimeMultipartEncrypted</type></link> part is a special subclass of
<link linkend="GMimeMultipart"><type>GMimeMultipart</type></link> to make it easier to manipulate the
multipart/encrypted MIME type.
</para>
</refsect1>
<refsect1 id="GMimeMultipartEncrypted.details" role="details">
<title role="details.title">Details</title>
<refsect2 id="GMimeMultipartEncrypted-struct" role="struct">
<title>GMimeMultipartEncrypted</title>
<indexterm zone="GMimeMultipartEncrypted-struct"><primary>GMimeMultipartEncrypted</primary></indexterm>
<programlisting>typedef struct _GMimeMultipartEncrypted GMimeMultipartEncrypted;</programlisting>
<para>
A multipart/encrypted MIME part.
</para><variablelist role="struct">
</variablelist></refsect2>
<refsect2 id="g-mime-multipart-encrypted-new" role="function">
<title>g_mime_multipart_encrypted_new ()</title>
<indexterm zone="g-mime-multipart-encrypted-new"><primary>g_mime_multipart_encrypted_new</primary></indexterm>
<programlisting><link linkend="GMimeMultipartEncrypted"><returnvalue>GMimeMultipartEncrypted</returnvalue></link> * g_mime_multipart_encrypted_new
                                                        (<parameter><type>void</type></parameter>);</programlisting>
<para>
Creates a new MIME multipart/encrypted object.
</para><variablelist role="params">
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> an empty MIME multipart/encrypted object.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="g-mime-multipart-encrypted-encrypt" role="function">
<title>g_mime_multipart_encrypted_encrypt ()</title>
<indexterm zone="g-mime-multipart-encrypted-encrypt"><primary>g_mime_multipart_encrypted_encrypt</primary></indexterm>
<programlisting><link linkend="int"><returnvalue>int</returnvalue></link>                 g_mime_multipart_encrypted_encrypt  (<parameter><link linkend="GMimeMultipartEncrypted"><type>GMimeMultipartEncrypted</type></link> *mpe</parameter>,
                                                         <parameter><link linkend="GMimeObject"><type>GMimeObject</type></link> *content</parameter>,
                                                         <parameter><link linkend="GMimeCryptoContext"><type>GMimeCryptoContext</type></link> *ctx</parameter>,
                                                         <parameter><link linkend="gboolean"><type>gboolean</type></link> sign</parameter>,
                                                         <parameter>const <link linkend="char"><type>char</type></link> *userid</parameter>,
                                                         <parameter><link linkend="GMimeDigestAlgo"><type>GMimeDigestAlgo</type></link> digest</parameter>,
                                                         <parameter><link linkend="GPtrArray"><type>GPtrArray</type></link> *recipients</parameter>,
                                                         <parameter><link linkend="GError"><type>GError</type></link> **err</parameter>);</programlisting>
<para>
Attempts to encrypt (and conditionally sign) the <parameter>content</parameter> MIME part
to the public keys of <parameter>recipients</parameter> using the <parameter>ctx</parameter> encryption
context. If successful, the encrypted <link linkend="GMimeObject"><type>GMimeObject</type></link> is set as the
encrypted part of the multipart/encrypted object <parameter>mpe</parameter>.
</para><variablelist role="params">
<varlistentry><term><parameter>mpe</parameter>&#160;:</term>
<listitem><simpara>multipart/encrypted object
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>content</parameter>&#160;:</term>
<listitem><simpara>MIME part to encrypt
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>ctx</parameter>&#160;:</term>
<listitem><simpara>encryption context
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>sign</parameter>&#160;:</term>
<listitem><simpara><link linkend="TRUE:CAPS"><literal>TRUE</literal></link> if the content should also be signed or <link linkend="FALSE:CAPS"><literal>FALSE</literal></link> otherwise
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>userid</parameter>&#160;:</term>
<listitem><simpara>user id to use for signing (only used if <parameter>sign</parameter> is <link linkend="TRUE:CAPS"><literal>TRUE</literal></link>)
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>digest</parameter>&#160;:</term>
<listitem><simpara>digest algorithm to use when signing
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>recipients</parameter>&#160;:</term>
<listitem><simpara>an array of recipients to encrypt to
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>err</parameter>&#160;:</term>
<listitem><simpara>a <link linkend="GError"><type>GError</type></link>
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> <link linkend="0:CAPS"><literal>0</literal></link> on success or <link linkend="1:CAPS"><literal>-1</literal></link> on fail. If the encryption fails, an
exception will be set on <parameter>err</parameter> to provide information as to why the
failure occured.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="g-mime-multipart-encrypted-decrypt" role="function">
<title>g_mime_multipart_encrypted_decrypt ()</title>
<indexterm zone="g-mime-multipart-encrypted-decrypt"><primary>g_mime_multipart_encrypted_decrypt</primary></indexterm>
<programlisting><link linkend="GMimeObject"><returnvalue>GMimeObject</returnvalue></link> *       g_mime_multipart_encrypted_decrypt  (<parameter><link linkend="GMimeMultipartEncrypted"><type>GMimeMultipartEncrypted</type></link> *mpe</parameter>,
                                                         <parameter><link linkend="GMimeCryptoContext"><type>GMimeCryptoContext</type></link> *ctx</parameter>,
                                                         <parameter><link linkend="GMimeDecryptResult"><type>GMimeDecryptResult</type></link> **result</parameter>,
                                                         <parameter><link linkend="GError"><type>GError</type></link> **err</parameter>);</programlisting>
<para>
Attempts to decrypt the encrypted MIME part contained within the
multipart/encrypted object <parameter>mpe</parameter> using the <parameter>ctx</parameter> decryption context.
</para>
<para>
If <parameter>result</parameter> is non-<link linkend="NULL:CAPS"><literal>NULL</literal></link>, then on a successful decrypt operation, it will be
updated to point to a newly-allocated <link linkend="GMimeDecryptResult"><type>GMimeDecryptResult</type></link> with signature
status information as well as a list of recipients that the part was
encrypted to.
</para><variablelist role="params">
<varlistentry><term><parameter>mpe</parameter>&#160;:</term>
<listitem><simpara>multipart/encrypted object
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>ctx</parameter>&#160;:</term>
<listitem><simpara>decryption context
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>result</parameter>&#160;:</term>
<listitem><simpara>a <link linkend="GMimeDecryptionResult"><type>GMimeDecryptionResult</type></link>
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>err</parameter>&#160;:</term>
<listitem><simpara>a <link linkend="GError"><type>GError</type></link>
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> the decrypted MIME part on success or <link linkend="NULL:CAPS"><literal>NULL</literal></link> on fail. If the
decryption fails, an exception will be set on <parameter>err</parameter> to provide
information as to why the failure occured.
</simpara></listitem></varlistentry>
</variablelist></refsect2>

</refsect1>
<refsect1 id="GMimeMultipartEncrypted.see-also">
<title>See Also</title>
<link linkend="GMimeMultipart"><type>GMimeMultipart</type></link>
</refsect1>

</refentry>
