## ESourceOpenPGP ESourceOpenPGP — ESource extension for OpenPGP settings |

## Synopsis

    #include <libedataserver/libedataserver.h>

    struct              ESourceOpenPGP;
    #define             E_SOURCE_EXTENSION_OPENPGP
    gboolean            e_source_openpgp_get_always_trust   (ESourceOpenPGP *extension);
    void                e_source_openpgp_set_always_trust   (ESourceOpenPGP *extension,
                                                             gboolean always_trust);
    gboolean            e_source_openpgp_get_encrypt_to_self
                                                            (ESourceOpenPGP *extension);
    void                e_source_openpgp_set_encrypt_to_self
                                                            (ESourceOpenPGP *extension,
                                                             gboolean encrypt_to_self);
    const gchar *       e_source_openpgp_get_key_id         (ESourceOpenPGP *extension);
    gchar *             e_source_openpgp_dup_key_id         (ESourceOpenPGP *extension);
    void                e_source_openpgp_set_key_id         (ESourceOpenPGP *extension,
                                                             const gchar *key_id);
    const gchar *       e_source_openpgp_get_signing_algorithm
                                                            (ESourceOpenPGP *extension);
    gchar *             e_source_openpgp_dup_signing_algorithm
                                                            (ESourceOpenPGP *extension);
    void                e_source_openpgp_set_signing_algorithm
                                                            (ESourceOpenPGP *extension,
                                                             const gchar *signing_algorithm);
    gboolean            e_source_openpgp_get_sign_by_default
                                                            (ESourceOpenPGP *extension);
    void                e_source_openpgp_set_sign_by_default
                                                            (ESourceOpenPGP *extension,
                                                             gboolean sign_by_default);

## Object Hierarchy

      GObject
       +----ESourceExtension
             +----ESourceOpenPGP

## Properties

      "always-trust"             gboolean              : Read / Write / Construct
      "encrypt-to-self"          gboolean              : Read / Write / Construct
      "key-id"                   gchar*                : Read / Write / Construct
      "sign-by-default"          gboolean              : Read / Write / Construct
      "signing-algorithm"        gchar*                : Read / Write / Construct

## Description

The ESourceOpenPGP extension tracks OpenPGP (RFC 4880) settings to be applied to outgoing mail messages.

Access the extension as follows:

    1
    2
    3
    4
    5
    #include <libedataserver/libedataserver.h>

    ESourceOpenPGP *extension;

    extension = e_source_get_extension (source, E_SOURCE_EXTENSION_OPENPGP);

## Details

### struct ESourceOpenPGP

    struct ESourceOpenPGP;

Contains only private data that should be read and manipulated using the functions below.

Since 3.6

### E_SOURCE_EXTENSION_OPENPGP

    #define E_SOURCE_EXTENSION_OPENPGP "Pretty Good Privacy (OpenPGP)"

Pass this extension name to `e_source_get_extension()` to access ESourceOpenPGP. This is also used as a group name in key files.

Since 3.6

### e_source_openpgp_get_always_trust ()

    gboolean            e_source_openpgp_get_always_trust   (ESourceOpenPGP *extension);

Returns whether to skip key validation and assume that used keys are always fully trusted.

`extension` : | an ESourceOpenPGP
Returns : | whether used keys are always fully trusted

Since 3.6

### e_source_openpgp_set_always_trust ()

    void                e_source_openpgp_set_always_trust   (ESourceOpenPGP *extension,
                                                             gboolean always_trust);

Sets whether to skip key validation and assume that used keys are always fully trusted.

`extension` : | an ESourceOpenPGP
`always_trust` : | whether used keys are always fully trusted

Since 3.6

### e_source_openpgp_get_encrypt_to_self ()

    gboolean            e_source_openpgp_get_encrypt_to_self
                                                            (ESourceOpenPGP *extension);

Returns whether to "encrypt-to-self" when sending encrypted messages.

`extension` : | an ESourceOpenPGP
Returns : | whether to "encrypt-to-self"

Since 3.6

### e_source_openpgp_set_encrypt_to_self ()

    void                e_source_openpgp_set_encrypt_to_self
                                                            (ESourceOpenPGP *extension,
                                                             gboolean encrypt_to_self);

Sets whether to "encrypt-to-self" when sending encrypted messages.

`extension` : | an ESourceOpenPGP
`encrypt_to_self` : | whether to "encrypt-to-self"

Since 3.6

### e_source_openpgp_get_key_id ()

    const gchar *       e_source_openpgp_get_key_id         (ESourceOpenPGP *extension);

Returns the OpenPGP key ID used to sign and encrypt messages.

`extension` : | an ESourceOpenPGP
Returns : | the key ID used to sign and encrypt messages

Since 3.6

### e_source_openpgp_dup_key_id ()

    gchar *             e_source_openpgp_dup_key_id         (ESourceOpenPGP *extension);

Thread-safe variation of `e_source_openpgp_get_key_id()`. Use this function when accessing `extension` from multiple threads.

The returned string should be freed with `g_free()` when no longer needed.

`extension` : | an ESourceOpenPGP
Returns : | a newly-allocated copy of "key-id"

Since 3.6

### e_source_openpgp_set_key_id ()

    void                e_source_openpgp_set_key_id         (ESourceOpenPGP *extension,
                                                             const gchar *key_id);

Sets the OpenPGP key ID used to sign and encrypt messages.

The internal copy of `key_id` is automatically stripped of leading and trailing whitespace. If the resulting string is empty, `NULL` is set instead.

`extension` : | an ESourceOpenPGP
`key_id` : | the key ID used to sign and encrypt messages

Since 3.6

### e_source_openpgp_get_signing_algorithm ()

    const gchar *       e_source_openpgp_get_signing_algorithm
                                                            (ESourceOpenPGP *extension);

Returns the name of the hash algorithm used to digitally sign outgoing messages.

`extension` : | an ESourceOpenPGP
Returns : | the signing algorithm for outgoing messages

Since 3.6

### e_source_openpgp_dup_signing_algorithm ()

    gchar *             e_source_openpgp_dup_signing_algorithm
                                                            (ESourceOpenPGP *extension);

Thread-safe variation of `e_source_openpgp_get_signing_algorithm()`. Use this function when accessing `extension` from multiple threads.

The returned string should be freed with `g_free()` when no longer needed.

`extension` : | an ESourceOpenPGP
Returns : | a newly-allocated copy of "signing-algorithm"

Since 3.6

### e_source_openpgp_set_signing_algorithm ()

    void                e_source_openpgp_set_signing_algorithm
                                                            (ESourceOpenPGP *extension,
                                                             const gchar *signing_algorithm);

Sets the name of the hash algorithm used to digitally sign outgoing messages.

The internal copy of `signing_algorithm` is automatically stripped of leading and trailing whitespace. If the resulting string is empty, `NULL` is set instead.

`extension` : | an ESourceOpenPGP
`signing_algorithm` : | the signing algorithm for outgoing messages

Since 3.6

### e_source_openpgp_get_sign_by_default ()

    gboolean            e_source_openpgp_get_sign_by_default
                                                            (ESourceOpenPGP *extension);

Returns whether to digitally sign outgoing messages by default using OpenPGP-compliant software such as GNU Privacy Guard (GnuPG).

`extension` : | an ESourceOpenPGP
Returns : | whether to sign outgoing messages by default

Since 3.6

### e_source_openpgp_set_sign_by_default ()

    void                e_source_openpgp_set_sign_by_default
                                                            (ESourceOpenPGP *extension,
                                                             gboolean sign_by_default);

Sets whether to digitally sign outgoing messages by default using OpenPGP-compliant software such as GNU Privacy Guard (GnuPG).

`extension` : | an ESourceOpenPGP
`sign_by_default` : | whether to sign outgoing messages by default

Since 3.6

## Property Details

### The `"always-trust"` property

      "always-trust"             gboolean              : Read / Write / Construct

Always trust keys in my keyring.

Default value: FALSE

### The `"encrypt-to-self"` property

      "encrypt-to-self"          gboolean              : Read / Write / Construct

Always encrypt to myself.

Default value: TRUE

### The `"key-id"` property

      "key-id"                   gchar*                : Read / Write / Construct

PGP/GPG Key ID.

Default value: NULL

### The `"sign-by-default"` property

      "sign-by-default"          gboolean              : Read / Write / Construct

Sign outgoing messages by default.

Default value: FALSE

### The `"signing-algorithm"` property

      "signing-algorithm"        gchar*                : Read / Write / Construct

Hash algorithm used to sign messages.

Default value: NULL