## GMimeMultipartEncrypted GMimeMultipartEncrypted — Encrypted MIME multiparts |

## Functions

GMimeMultipartEncrypted * | g_mime_multipart_encrypted_new ()
GMimeMultipartEncrypted * | g_mime_multipart_encrypted_encrypt ()
GMimeObject * | g_mime_multipart_encrypted_decrypt ()

## Types and Values

struct | GMimeMultipartEncrypted

## Object Hierarchy

        GObject
        ╰── GMimeObject
            ╰── GMimeMultipart
                ╰── GMimeMultipartEncrypted

## Description

A GMimeMultipartEncrypted part is a special subclass of GMimeMultipart to make it easier to manipulate the multipart/encrypted MIME type.

## Functions

### g_mime_multipart_encrypted_new ()

    GMimeMultipartEncrypted *
    g_mime_multipart_encrypted_new (void);

Creates a new MIME multipart/encrypted object.

#### Returns

an empty MIME multipart/encrypted object.

### g_mime_multipart_encrypted_encrypt ()

    GMimeMultipartEncrypted *
    g_mime_multipart_encrypted_encrypt (GMimeCryptoContext *ctx,
                                        GMimeObject *entity,
                                        gboolean sign,
                                        const char *userid,
                                        GMimeEncryptFlags flags,
                                        GPtrArray *recipients,
                                        GError **err);

Attempts to encrypt (and conditionally sign) the `entity` MIME part to the public keys of `recipients` using the `ctx` encryption context. If successful, a new multipart/encrypted object is returned.

#### Parameters

ctx | a GMimeCryptoContext |
entity | MIME part to encrypt |
sign | `TRUE` if the content should also be signed or `FALSE` otherwise |
userid | user id to use for signing (only used if `sign` is `TRUE`). | [nullable]
flags | a GMimeEncryptFlags |
recipients | an array of recipients to encrypt to. | [element-type utf8]
err | a GError |

#### Returns

a new GMimeMultipartEncrypted object on success or `NULL` on fail. If encrypting fails, an exception will be set on `err` to provide information as to why the failure occurred.

[nullable][transfer full]

### g_mime_multipart_encrypted_decrypt ()

    GMimeObject *
    g_mime_multipart_encrypted_decrypt (GMimeMultipartEncrypted *encrypted,
                                        GMimeDecryptFlags flags,
                                        const char *session_key,
                                        GMimeDecryptResult **result,
                                        GError **err);

Attempts to decrypt the encrypted MIME part contained within the multipart/encrypted object `encrypted` .

When non-`NULL`, `session_key` should be a `NULL`-terminated string, such as the one returned by `g_mime_decrypt_result_get_session_key()` from a previous decryption. If the `session_key` is not valid, decryption will fail.

If `result` is non-`NULL`, then on a successful decrypt operation, it will be updated to point to a newly-allocated GMimeDecryptResult with signature status information as well as a list of recipients that the part was encrypted to.

#### Parameters

encrypted | a GMimeMultipartEncrypted |
flags | a GMimeDecryptFlags |
session_key | session key to use or `NULL` |
result | a GMimeDecryptResult. | [out][transfer full]
err | a GError |

#### Returns

the decrypted MIME part on success or `NULL` on fail. If the decryption fails, an exception will be set on `err` to provide information as to why the failure occurred.

[nullable][transfer full]

## Types and Values

### struct GMimeMultipartEncrypted

    struct GMimeMultipartEncrypted;

A multipart/encrypted MIME part.

#### Members

## See Also

GMimeMultipart