## CamelGpgContext

CamelGpgContext

## Functions

CamelGpgKeyInfo * | camel_gpg_key_info_copy ()
void | camel_gpg_key_info_free ()
const gchar * | camel_gpg_key_info_get_id ()
const gchar * | camel_gpg_key_info_get_fingerprint ()
gint64 | camel_gpg_key_info_get_creation_date ()
CamelGpgTrust | camel_gpg_key_info_get_trust ()
CamelCipherContext * | camel_gpg_context_new ()
gboolean | camel_gpg_context_get_always_trust ()
void | camel_gpg_context_set_always_trust ()
gboolean | camel_gpg_context_get_prefer_inline ()
void | camel_gpg_context_set_prefer_inline ()
gboolean | camel_gpg_context_get_locate_keys ()
void | camel_gpg_context_set_locate_keys ()
gboolean | camel_gpg_context_has_public_key_sync ()
gboolean | camel_gpg_context_get_public_key_sync ()
gboolean | camel_gpg_context_get_public_key_info_sync ()
gboolean | camel_gpg_context_get_key_data_info_sync ()
gboolean | camel_gpg_context_set_key_trust_sync ()
gboolean | camel_gpg_context_import_key_sync ()

## Properties

gboolean | always-trust | Read / Write / Construct
gboolean | locate-keys | Read / Write / Construct
gboolean | prefer-inline | Read / Write / Construct

## Object Hierarchy

        GBoxed
        ╰── CamelGpgKeyInfo
        GObject
        ╰── CamelCipherContext
            ╰── CamelGpgContext

## Description

## Functions

### camel_gpg_key_info_copy ()

    CamelGpgKeyInfo *
    camel_gpg_key_info_copy (const CamelGpgKeyInfo *src);

Copies the `src` to a new CamelGpgKeyInfo structure.

#### Parameters

src | a source CamelGpgKeyInfo to make a copy of. | [nullable]

#### Returns

a copy of the `src` , or `NULL`, when the `src` is also `NULL`.

[transfer full][nullable]

Since: 3.50

### camel_gpg_key_info_free ()

    void
    camel_gpg_key_info_free (CamelGpgKeyInfo *info);

Frees the `info` previously allocated by `camel_gpg_context_get_public_key_info_sync()`, `camel_gpg_context_get_key_data_info_sync()` or `camel_gpg_key_info_copy()`.

#### Parameters

info | a CamelGpgKeyInfo |

Since: 3.50

### camel_gpg_key_info_get_id ()

    const gchar *
    camel_gpg_key_info_get_id (const CamelGpgKeyInfo *info);

Gets the key ID.

#### Parameters

info | a CamelGpgKeyInfo |

#### Returns

key ID

Since: 3.50

### camel_gpg_key_info_get_fingerprint ()

    const gchar *
    camel_gpg_key_info_get_fingerprint (const CamelGpgKeyInfo *info);

Gets the key fingerprint.

#### Parameters

info | a CamelGpgKeyInfo |

#### Returns

key fingerprint

Since: 3.50

### camel_gpg_key_info_get_creation_date ()

    gint64
    camel_gpg_key_info_get_creation_date (const CamelGpgKeyInfo *info);

Gets the key creating date, as seconds since the Unix Epoch.

#### Parameters

info | a CamelGpgKeyInfo |

#### Returns

key creation date

Since: 3.50

### camel_gpg_key_info_get_trust ()

    CamelGpgTrust
    camel_gpg_key_info_get_trust (const CamelGpgKeyInfo *info);

Gets the key trust level, as one of CamelGpgTrust.

#### Parameters

info | a CamelGpgKeyInfo |

#### Returns

key trust level

Since: 3.50

### camel_gpg_context_new ()

    CamelCipherContext *
    camel_gpg_context_new (CamelSession *session);

Creates a new gpg cipher context object.

#### Parameters

session | session. | [nullable]

#### Returns

a new gpg cipher context object.

### camel_gpg_context_get_always_trust ()

    gboolean
    camel_gpg_context_get_always_trust (CamelGpgContext *context);

#### Parameters

context | a CamelGpgContext |

Since: 2.32

### camel_gpg_context_set_always_trust ()

    void
    camel_gpg_context_set_always_trust (CamelGpgContext *context,
                                        gboolean always_trust);

Sets the `always_trust` flag on the gpg context which is used for encryption.

#### Parameters

context | gpg context |
always_trust | always trust flag |

### camel_gpg_context_get_prefer_inline ()

    gboolean
    camel_gpg_context_get_prefer_inline (CamelGpgContext *context);

#### Parameters

context | a CamelGpgContext |

#### Returns

Whether prefer inline sign/encrypt (`TRUE`), or as multiparts (`FALSE`)

Since: 3.20

### camel_gpg_context_set_prefer_inline ()

    void
    camel_gpg_context_set_prefer_inline (CamelGpgContext *context,
                                         gboolean prefer_inline);

Sets the `prefer_inline` flag on the gpg context.

#### Parameters

context | gpg context |
prefer_inline | whether prefer inline sign/encrypt |

Since: 3.20

### camel_gpg_context_get_locate_keys ()

    gboolean
    camel_gpg_context_get_locate_keys (CamelGpgContext *context);

Returns, whether gpg can locate keys using Web Key Directory (WKD) lookup when encrypting messages. The default is `TRUE`.

#### Parameters

context | a CamelGpgContext |

#### Returns

whether gpg can locate keys using Web Key Directory (WKD) lookup when encrypting messages.

Since: 3.46

### camel_gpg_context_set_locate_keys ()

    void
    camel_gpg_context_set_locate_keys (CamelGpgContext *context,
                                       gboolean locate_keys);

Sets the `locate_keys` on the gpg context which is used to instruct gpg to locate keys using Web Key Directory (WKD) lookup when encrypting messages.

#### Parameters

context | gpg context |
locate_keys | value to set |

Since: 3.46

### camel_gpg_context_has_public_key_sync ()

    gboolean
    camel_gpg_context_has_public_key_sync (CamelGpgContext *context,
                                           const gchar *keyid,
                                           GCancellable *cancellable,
                                           GError **error);

Checks whether there exists a public key with `keyid` .

The `keyid` can be either key ID or an email address.

#### Parameters

context | a CamelGpgContext |
keyid | a key ID or an email address |
cancellable | optional GCancellable object, or `NULL` |
error | return location for a GError, or `NULL` |

#### Returns

whether the key could be found

Since: 3.50

### camel_gpg_context_get_public_key_sync ()

    gboolean
    camel_gpg_context_get_public_key_sync (CamelGpgContext *context,
                                           const gchar *keyid,
                                           guint32 flags,
                                           guint8 **out_data,
                                           gsize *out_data_size,
                                           GCancellable *cancellable,
                                           GError **error);

Returns a public key with `keyid` .

The `keyid` can be either key ID or an email address.

The `flags` argument is currently unused and should be set to 0.

The `out_data` content should be freed with `g_free()`, when no longer needed.

#### Parameters

context | a CamelGpgContext |
keyid | a key ID or an email address |
flags | flags for the operation |
out_data | return location for the public key data, in binary form. | [out][transfer full]
out_data_size | return location to store the `out_data` size to. | [out]
cancellable | optional GCancellable object, or `NULL` |
error | return location for a GError, or `NULL` |

#### Returns

whether succeeded

Since: 3.50

### camel_gpg_context_get_public_key_info_sync ()

    gboolean
    camel_gpg_context_get_public_key_info_sync
                                   (CamelGpgContext *context,
                                    const gchar *keyid,
                                    guint32 flags,
                                    GSList **out_infos,
                                    GCancellable *cancellable,
                                    GError **error);

Receives information about a key `keyid` .

The `keyid` can be either key ID or an email address.

The `flags` argument is currently unused and should be set to 0.

Free the returned `out_infos` with g_slist_free_full (infos, camel_gpg_key_info_free); when no longer needed.

#### Parameters

context | a CamelGpgContext |
keyid | a key ID or an email address |
flags | flags for the operation |
out_infos | an out parameter to get GSList of CamelGpgKeyInfo structures. | [out callee-allocates][transfer full][element-type CamelGpgKeyInfo]
cancellable | optional GCancellable object, or `NULL` |
error | return location for a GError, or `NULL` |

#### Returns

whether succeeded

Since: 3.50

### camel_gpg_context_get_key_data_info_sync ()

    gboolean
    camel_gpg_context_get_key_data_info_sync
                                   (CamelGpgContext *context,
                                    const guint8 *data,
                                    gsize data_size,
                                    guint32 flags,
                                    GSList **out_infos,
                                    GCancellable *cancellable,
                                    GError **error);

Receives information about a key stored in `data` of size `data_size` .

The `flags` argument is currently unused and should be set to 0.

Free the returned `out_infos` with g_slist_free_full (infos, camel_gpg_key_info_free); when no longer needed.

#### Parameters

context | a CamelGpgContext |
data | the public key data |
data_size | the `data` size |
flags | flags for the operation |
out_infos | an out parameter to get GSList of CamelGpgKeyInfo structures. | [out callee-allocates][transfer full][element-type CamelGpgKeyInfo]
cancellable | optional GCancellable object, or `NULL` |
error | return location for a GError, or `NULL` |

#### Returns

whether succeeded

Since: 3.50

### camel_gpg_context_set_key_trust_sync ()

    gboolean
    camel_gpg_context_set_key_trust_sync (CamelGpgContext *context,
                                          const gchar *keyid,
                                          CamelGpgTrust trust,
                                          GCancellable *cancellable,
                                          GError **error);

Sets `trust` level on the key `keyid` .

The `keyid` can be either key ID or an email address.

#### Parameters

context | a CamelGpgContext |
keyid | a key ID or an email address |
trust | a CamelGpgTrust to set |
cancellable | optional GCancellable object, or `NULL` |
error | return location for a GError, or `NULL` |

#### Returns

whether succeeded

Since: 3.50

### camel_gpg_context_import_key_sync ()

    gboolean
    camel_gpg_context_import_key_sync (CamelGpgContext *context,
                                       const guint8 *data,
                                       gsize data_size,
                                       guint32 flags,
                                       GCancellable *cancellable,
                                       GError **error);

Imports a (public) key provided in a binary form stored in the `data` of size `data_size` .

#### Parameters

context | a CamelGpgContext |
data | the public key data |
data_size | the `data` size |
flags | bit-or of CamelPgpImportFlags, flags for the operation |
cancellable | optional GCancellable object, or `NULL` |
error | return location for a GError, or `NULL` |

#### Returns

whether succeeded

Since: 3.50

## Property Details

### The `“always-trust”` property

      “always-trust”             gboolean

Owner: CamelGpgContext

Flags: Read / Write / Construct

Default value: FALSE

### The `“locate-keys”` property

      “locate-keys”              gboolean

Owner: CamelGpgContext

Flags: Read / Write / Construct

Default value: TRUE

### The `“prefer-inline”` property

      “prefer-inline”            gboolean

Owner: CamelGpgContext

Flags: Read / Write / Construct

Default value: FALSE