GPGME adapter provides OpenPGP-compliant cryptography via GnuPG Made Easy library.

Dependencies

This adapter requries two additional pieces of software to be installed:

  1. GnuPG, version 2.2

  2. gpgme gem

Options

Following adapter-specific options are supported:

signer

Optional. User id or e-mail which identifies key which will be used for message signing. By default, first address from mail’s From field is used.

key_password

Optional. Password for signer’s key. Must be a string.

Non-standard home directory location

GnuPG home directory is a place where configuration, keyrings, etc. are stored. By default, GnuPG home directory is located in $HOME/.gnupg. You can change it in a following way:

::GPGME::Engine.home_dir = 'path/to/home_dir'

Be advised that this setting is global. Hence, if you use GPGME outside EnMail as well, your other logic will be affected. One possible workaround is to sign e-mails in a different process. This should be fairly easy to achieve in Rails, as mailing is often handed to some kind of background job processor which runs in its own process. Nevertheless, consider switching to RNP adapter if this limitation poses a problem.

Using gpg.conf

GPGME API accepts little configuration options. Instead, it reads preferences from a gpg.conf file located in GnuPG home directory (usually $HOME/.gnupg). You may override defaults there, i.e. set preferred keys or algorithms. Refer to GnuPG documentation for more information about configuration files, or for list of available options. Also, you will find some nice example gpg.conf in this Stack Overflow answer.

Native extensions

The gpgme gem includes C extensions.

Issue tracker

Bugs, feature requests, and other issues are tracked with adapter: gpgme label: https://github.com/riboseinc/enmail/issues?q=is%3Aissue+is%3Aopen+label%3A%22adapter%3A+gpgme%22