## GMimeApplicationPkcs7Mime GMimeApplicationPkcs7Mime — Pkcs7 MIME parts |

## Functions

GMimeApplicationPkcs7Mime * | g_mime_application_pkcs7_mime_new ()
GMimeSecureMimeType | g_mime_application_pkcs7_mime_get_smime_type ()
GMimeApplicationPkcs7Mime * | g_mime_application_pkcs7_mime_encrypt ()
GMimeObject * | g_mime_application_pkcs7_mime_decrypt ()
GMimeApplicationPkcs7Mime * | g_mime_application_pkcs7_mime_sign ()
GMimeSignatureList * | g_mime_application_pkcs7_mime_verify ()

## Types and Values

struct | GMimeApplicationPkcs7Mime
enum | GMimeSecureMimeType

## Object Hierarchy

        GObject
        ╰── GMimeObject
            ╰── GMimePart
                ╰── GMimeApplicationPkcs7Mime

## Description

A GMimeApplicationPkcs7Mime represents the application/pkcs7-mime MIME part.

## Functions

### g_mime_application_pkcs7_mime_new ()

    GMimeApplicationPkcs7Mime *
    g_mime_application_pkcs7_mime_new (GMimeSecureMimeType type);

Creates a new application/pkcs7-mime object.

#### Parameters

type | The type of S/MIME data contained within the part. |

#### Returns

an empty application/pkcs7-mime object.

### g_mime_application_pkcs7_mime_get_smime_type ()

    GMimeSecureMimeType
    g_mime_application_pkcs7_mime_get_smime_type
                                   (GMimeApplicationPkcs7Mime *pkcs7_mime);

Gets the smime-type value of the Content-Type header.

#### Parameters

pkcs7_mime | A GMimeApplicationPkcs7Mime object |

#### Returns

the smime-type value.

### g_mime_application_pkcs7_mime_encrypt ()

    GMimeApplicationPkcs7Mime *
    g_mime_application_pkcs7_mime_encrypt (GMimeObject *entity,
                                           GMimeEncryptFlags flags,
                                           GPtrArray *recipients,
                                           GError **err);

Attempts to encrypt the `entity` MIME part to the public keys of `recipients` using S/MIME. If successful, a new application/pkcs7-mime object is returned.

#### Parameters

entity | a GMimeObject to encrypt |
flags | a GMimeEncryptFlags |
recipients | an array of recipients to encrypt to. | [element-type utf8]
err | a GError |

#### Returns

a new GMimeApplicationPkcs7Mime 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_application_pkcs7_mime_decrypt ()

    GMimeObject *
    g_mime_application_pkcs7_mime_decrypt (GMimeApplicationPkcs7Mime *pkcs7_mime,
                                           GMimeDecryptFlags flags,
                                           const char *session_key,
                                           GMimeDecryptResult **result,
                                           GError **err);

Attempts to decrypt the encrypted application/pkcs7-mime part.

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

pkcs7_mime | a GMimeApplicationPkcs7Mime |
flags | a GMimeDecryptFlags |
session_key | session key to use or `NULL` |
result | the decryption result |
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]

### g_mime_application_pkcs7_mime_sign ()

    GMimeApplicationPkcs7Mime *
    g_mime_application_pkcs7_mime_sign (GMimeObject *entity,
                                        const char *userid,
                                        GError **err);

Attempts to sign the `entity` MIME part with `userid` 's private key using S/MIME. If successful, a new application/pkcs7-mime object is returned.

#### Parameters

entity | a GMimeObject |
userid | the user id to sign with |
err | a GError |

#### Returns

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

[nullable][transfer full]

### g_mime_application_pkcs7_mime_verify ()

    GMimeSignatureList *
    g_mime_application_pkcs7_mime_verify (GMimeApplicationPkcs7Mime *pkcs7_mime,
                                          GMimeVerifyFlags flags,
                                          GMimeObject **entity,
                                          GError **err);

Attempts to verify the signed `pkcs7_mime` part and extract the original MIME entity.

#### Parameters

pkcs7_mime | a GMimeApplicationPkcs7Mime |
flags | a GMimeVerifyFlags |
entity | the extracted entity. | [out][transfer full]
err | a GError |

#### Returns

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

[nullable][transfer full]

## Types and Values

### struct GMimeApplicationPkcs7Mime

    struct GMimeApplicationPkcs7Mime;

An application/pkcs7-mime MIME part.

#### Members

### enum GMimeSecureMimeType

The S/MIME data type.

#### Members

GMIME_SECURE_MIME_TYPE_COMPRESSED_DATA | The S/MIME content contains compressed data. |
GMIME_SECURE_MIME_TYPE_ENVELOPED_DATA | The S/MIME content contains enveloped data. |
GMIME_SECURE_MIME_TYPE_SIGNED_DATA | The S/MIME content contains signed data. |
GMIME_SECURE_MIME_TYPE_CERTS_ONLY | The S/MIME content contains only certificates. |
GMIME_SECURE_MIME_TYPE_UNKNOWN | The S/MIME content is unknown. |