Site icon R-bloggers

{emayili} Sending Encrypted Email

[This article was first published on R - datawookie, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

In a previous post I documented what I had learned while trying to understand the structure of encrypted emails. I then took an informal Twitter poll to gauge how many people are using encrypted email messages.

It’s by no means a statistically representative sample, but I’ll go out on a limb and state that not many people are actually encrypting their email. I have a few hypotheses which might explain this:

I think that securing your personal communications is becoming progressively more important. So I’m going to be using GnuPG to encrypt and sign emails in future.

In this post I’m going to demonstrate a new feature in {emayili}, which makes it possible to easily send encrypted messages from R. This feature leans heavily on the excellent {gpg} package developed by Jeroen Ooms.

Load Emayili

First let’s load {emayili}.

library(emayili)
#
# And {dplyr} because I use this everywhere!
#
library(dplyr)

packageVersion("emayili")

The encryption feature is only available from version 0.7.0. At present you’ll need to install this from GitHub because it’s not on CRAN yet.

You don’t need to explicitly load {gpg} to use encryption with {emayili}, but we’ll do so just to check on the version of GPG and create some keys to play with.

library(gpg)

gpg_version()
gpg (GnuPG) 2.2.19
libgcrypt 1.8.5
Copyright (C) 2019 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Home: /home/wookie/.gnupg
Supported algorithms:
Pubkey: RSA, ELG, DSA, ECDH, ECDSA, EDDSA
Cipher: IDEA, 3DES, CAST5, BLOWFISH, AES, AES192, AES256, TWOFISH,
        CAMELLIA128, CAMELLIA192, CAMELLIA256
Hash: SHA1, RIPEMD160, SHA256, SHA384, SHA512, SHA224
Compression: Uncompressed, ZIP, ZLIB, BZIP2

Creating Keys

We’ll set the scene by creating a few keys in a temporary location so that we don’t clobber our existing keyring.

gpg_restart(home = tempdir(), silent = TRUE)

For entertainment we’ll simulate encrypted communications around the D-Day landings. We’ll need some (obviously fictitious) email addresses and keys.

FLOTILLA  <- "flotilla@kriegsmarine.gov"
BORCHERS  <- "borchers-276@kriegsmarine.gov"
SCHUNK  <- "schunk-348@kriegsmarine.gov"
gpg_keygen(name = "Flotilla", email = FLOTILLA)
gpg_keygen(name = "U 276 Borchers", email = BORCHERS)
gpg_keygen(name = "U 348 Schunk", email = SCHUNK)

Now take a look at our keyring.

gpg_list_keys() %>% select(id, fingerprint, name)
                id                              fingerprint           name
1 A54509CACB0F295E CE08B765CA067CAA57764F5EA54509CACB0F295E       Flotilla
2 0897DF3055C00B2F AAA3971869729272BBD61F730897DF3055C00B2F U 276 Borchers
3 0665C3E83FBB901B EF5AA9E78B78836AD16399180665C3E83FBB901B   U 348 Schunk

Publishing Keys

Publishing those keys could be done as follows (although we won’t actually publish the keys for obvious reasons!):

gpg --keyserver keyserver.ubuntu.com --send-key CE08B765CA067CAA57764F5EA54509CACB0F295E
gpg --keyserver pgp.mit.edu --send-key AAA3971869729272BBD61F730897DF3055C00B2F
gpg --keyserver keys.openpgp.org --send-key 0665C3E83FBB901B

The keys can be referenced by id or fingerprint.

Creating a Message

What about a message body? The message below was intercepted at 04:30 UTC on 6 June 1944 and subsequently decrypted by the codebreakers at Bletchley Park.

SUBJECT <- "Attention"
TEXT <- "Immediate readiness. There are indications that the invasion has begun."

Create an {emayili} message object.

msg <- envelope(
  from = FLOTILLA,
  to = c(BORCHERS, SCHUNK),
  subject = SUBJECT,
  text = TEXT
)
Date:                        Tue, 21 Dec 2021 11:51:35 GMT
X-Mailer:                    {emayili}-0.7.1
MIME-Version:                1.0
To:                          borchers-276@kriegsmarine.gov,
                              schunk-348@kriegsmarine.gov
From:                        flotilla@kriegsmarine.gov
Subject:                     Attention
Content-Type:                text/plain;
                              charset=utf-8;
                              format=flowed
Content-Disposition:         inline
Content-Transfer-Encoding:   7bit
Content-MD5:                 HvL4qIrj5lMuW+E5BW4APA==

Immediate readiness. There are indications that the invasion has begun.

This is a simple, unsecured text massage.

Sign a Message

To add a digital signature to the message use the encrypt() function and set encrypt = FALSE but sign = TRUE. It’s also possible to enable a signature using the sign option to envelope().

msg %>% encrypt(encrypt = FALSE, sign = TRUE)
Date:                        Tue, 21 Dec 2021 11:51:35 GMT
X-Mailer:                    {emayili}-0.7.1
MIME-Version:                1.0
To:                          borchers-276@kriegsmarine.gov,
                              schunk-348@kriegsmarine.gov
From:                        flotilla@kriegsmarine.gov
Subject:                     Attention
Content-Type:                multipart/signed;
                              micalg="{micalg}";
                              protocol="application/pgp-signature";
                              boundary="167afbbc"

This is an OpenPGP/MIME signed message (RFC 4880 and 3156).
--167afbbc
Content-Type:                multipart/mixed;
                              boundary="626aabd9"

--626aabd9
Content-Type:                text/plain;
                              charset=utf-8;
                              format=flowed
Content-Disposition:         inline
Content-Transfer-Encoding:   7bit
Content-MD5:                 HvL4qIrj5lMuW+E5BW4APA==

Immediate readiness. There are indications that the invasion has begun.
--626aabd9
Content-Type:                application/pgp-keys;
                              name="keys.asc"
Content-Description:         OpenPGP public key
Content-Disposition:         attachment; filename="keys.asc"
Content-Transfer-Encoding:   quoted-printable
Content-MD5:                 D7N/W9JAtMx0h9bi8uVf2g==

-----BEGIN PGP PUBLIC KEY BLOCK-----

mQGNBGHBv8IBDADjMnW6CefCThWE51Dmmt4NXOXgfa3d714sAFpsW4P1wZ0SDe+9
EShptxAM1VYaM4LMh1fHIVHtPOTbpBrjyqG5XnYJ70yO42bWXUlWHaSh7jvKKfi6
1jBTolryITPu/KQl/gI51xfe5hZR0jLZGq7oAg9n0/kVlUQXzFk5IC8TqUeFNqAj
N44+rRHjIs/JOjauzOSZIAFUc8djFbVgyTzwcGjhBFuhhb4JERgC3/GQfHmW1riZ
a3XRK/DM1EynFb1apWz2r6Qd/kKtg7EDgEMLRPqJcYr9ZRTa7wSozkUk02QmS54a
84p/3DJySw2ewAeD8Z8KlktvyZr9YAwjPmeLFcz09xP8+gtTC5XqySs/u1Qt6CU2
NLqWpzmNPP/Zj37VP1uZ/JXmfZtfMtkMKSgTbdd/XP/sPptujqKKsM8Ku7lciCH1
f0snBBGsw+LLY53khJGiWqyV0L+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p
nsgsyNs9MbhDR+iuqFKHQpJQGn1sfZLMQOulul5uwRPyHe0vY933ZTKcqQtsRj4y
mN08f5gTB/Pydb5TjNCxiiHhoWQ7h4JVx0yVrg/HO5UdaHtllHXp5cKhpqoOo2PY
NCHHjy3E33NAYGZKdv9icC4g+c7HO2JTh0QNEqVbOPJFa5ugnuh6FLi/HyY50TE5
i+TmFAg+sTUAEQEAAYkBtgQYAQoAIBYhBOO2Te5rkebPLhCBs+yMGoRL975pBQJh
wb/CAhsMAAoJEOyMGoRL975ph6IMAM+sYC+fenRRBfJ88on3CUPYkOO2bfhJRtWF
Q4+raY3hHp/iAJ2FSv3qXdINFKX8TUMLO6iEkgOPLXcJbUrHD/uEm5mgAnN42D+N
okJSdPnrM1lIwI589HtgFGf0EG5DlruKR3co2lyLPnWpsHvIJVgGyEVHdy+Mt/6/
Yy6TUsAjuXzsGJsw2q1ywAXp12m7t3C8O3Yqh0HvhiJdUIAj54gze6zyO1CId0OM
EDhl6G6MOTAiyzBYhLl8s4NjYXMgsmUWDqJPW9AmDaJIW5/awRwX1NU6X7cpVdVR
reUqrbmnfOdz1qSv2hLtZMCBCB7iBOqykESSkUgiZwG/DNtJJOp1GM/FLbHz8RqK
8VSBIyJJ+aL2/46lmBc/6XGSNzxq0MUTLLBbaIk53MQ4W6hTGsgY1Uy8A3jL4wws
c0fhkma5VJjeew7SgyuugKC9d8PpJdW9f4X/hFSWQCB1D7oeNI+XsC/JIA/4PuWZ
2zgHSAgXMD14ety/rEabMmNJfYtQ0Q=3D=3D
=3DpR88
-----END PGP PUBLIC KEY BLOCK-----

--626aabd9--
--167afbbc
Content-Type:                application/pgp-signature;
                              name="signature.asc"
Content-Description:         OpenPGP digital signature
Content-Disposition:         attachment; filename="signature.asc"

-----BEGIN PGP SIGNATURE-----

iQGzBAABCgAdFiEE47ZN7muR5s8uEIGz7IwahEv3vmkFAmHBv8cACgkQ7IwahEv3
vmmm0wv+P2EBIG47BqalgKmY14kj7P+gAaBmNZPOkgmuMmQkcJkf8HoGEuNfx1l+
bjA9ZqBwsLtu0b4cAZCsiV4esL4jfXnQuh/X1mUPRWna8o7ycLTAg7ceVelsDm97
15zDFfDPgnXIkhrU0fJy2GafeD+bRZKhTjqVkQRvO/5WsmQZvHnxWS5TcH5dZe8k
g9b23EE2oFyqbznpvN82RZoqBtjQCYrQMZsvIe4TPRPZ83AQCkMyrQmyiltZi9Ja
c3lmcKWhVzKkTLc9kO7s+iB3lcrZNcJCKMgUi6LS4CAhksZBviCx+wrqjN34GBs7
JHhlhTyOfAsRvXY//TLQUb9nVRgJr1VKG9Qvn73ljT9AhuqDtqmMbCLyUwC1Rpyw
LjpjHKj/z/vy2ECxkB2z/dsQRmUEZUsShpe3cVmRGeux8LwnuyC57hZ/mWPsgDL2
Ywt/GKsMAZO5DjpsWVZ3WlqV6HzA5nlWn4q8FqUtxJdh1O5lDPGyrW0BzuUKTxdc
8JYKQrdC
=3mP/
-----END PGP SIGNATURE-----

--167afbbc--

The resulting message now includes:

  • the public key for the sender (PGP PUBLIC KEY) and
  • a digital signature (PGP SIGNATURE).

The structure of the MIME message is such that the signature covers both the message and the public key. In this way the sender is also authenticating the validity of the public key that they are sharing. For brevity you can omit the public key by setting the public_key = FALSE option to encrypt().

The commanders of U 276 and U 348 could validate the authenticity of the message by using the published public key for .

Encrypt a Message

Signing a message establishes its authenticity, but for secure communications you’d want to encrypt the contents of the message too. Again, use the encrypt() function with encrypt = TRUE (this is the default). It’s also possible to enable encryption using the encrypt option to envelope().

msg %>% encrypt(encrypt = TRUE)
Date:                        Tue, 21 Dec 2021 11:51:35 GMT
X-Mailer:                    {emayili}-0.7.1
MIME-Version:                1.0
To:                          borchers-276@kriegsmarine.gov,
                              schunk-348@kriegsmarine.gov
From:                        flotilla@kriegsmarine.gov
Subject:                     Attention
Content-Type:                multipart/encrypted;
                              protocol="application/pgp-encrypted";
                              boundary="b23cd7f7"

This is an OpenPGP/MIME encrypted message (RFC 4880 and 3156).
--b23cd7f7
Content-Type:                application/pgp-encrypted
Content-Description:         PGP/MIME version identification

Version: 1
--b23cd7f7
Content-Type:                application/octet-stream;
                              name="encrypted.asc"
Content-Description:         OpenPGP encrypted message
Content-Disposition:         inline; filename="encrypted.asc"

-----BEGIN PGP MESSAGE-----

hQGMAxtnPMmdBoF0AQwAquieITQYOZ7rR/TqLnEe4CGRN3lFSgmwW0aRjcQ5DLXC
z94AFOCfDQXimVHcfkbttWNtn0PGnaJmhqGEtoSyKHDzeS50q7YjRMEegIozF/3a
dCtKYm612Faoe82Tup1qKo2QgGJVctctBcwSQGm5FSi0YpbN226dJDKTcyG+atM8
axfXmUQd+wDLDF6ydxvkBweAWS0pfcyOixKVvVd3gQhD57rEJqyvFjN6iktkh4za
qnoLAvVseepbhhiVEECDJukwOHwmaLB/5h1vq3aJZOahwzaIBKgl/Kui+h7H9zg0
L4v9CXgjVHdK1fDVqUxKYcME6fjRSs3xdrmDSh344blvhdsewSe8CIqRLK4RiYkR
X3FwL1j3R1RCYU81WiFIRbJPlrgKUPcHVJVqi3tjTsQL8zWDjNNSJGSemyPGx6T3
ytyS/VFl3Jkp3yfs79CAAkl1qWs5FsgxSF2jy1aJPd/HIUVQjOr07DLKEbFL9ZHh
wMpsrq3opchZX46Kw24LhQGMA/vE6EGId8GsAQv/dIbNJntFWOre4CauWVKe9xfi
IOcWuqsJINF9+XCl3p+Qwf0YuAjA8mRuM68mA7MmOLAUp39f7usRF9zpqVyMLFZ/
xuyAFwGaYhECr2Mng5D/Z2gcg5l+QicX3Uq7OSMaAGu4hS4hzJUg5ZlL+bGjYvLU
mwWZBE/UgwUIsr1Ad+mVw2N38qFruSYBQ+Qu1l96oYU75u0mk6XS6Ey6ENi1SVNd
E2jcR1mP8E26ukpDXQTXvNFXc8H6ckitsIIUW3gfl8F2JZ39ZgnApo21+SLBtQNI
o0pAHqvVPRif6EA8PaET1TgY2RR4jjcuMpxekKdFZuAA2/6bBpvehcRmVSI/Z+p1
25IMNVTPzvwlDF+PD1YXfozj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gEZgHqB1IJfAIpEpNf3sV0N9UqNU1kNHCoHHqvhy6cRD1lhlNVpZX
DSowx53QD2et5tVFgTyikozEINuXrOlbr5EsGqFwa+wOXwX+qaOY70nHndknrSwe
ss2dYNo2gPXtyrJFsDOO25PdNhGXzdYL4H5TUToprwjUIQ9+LVrpktCdrEj2UBgU
CGp+/srRZU6JUUq2T7b1QnUvkqe+MN9IV+5Pvfyho8EkiyUKNv/E7rF9TqlU2L+L
8TPGcvU01p3dhdEqWKhoRj83M6pzlmUXhj3pA59sQhA+RHiKeWv1suIsqObwps+X
YdyOIehj2n8Inno55U+4Kln4O5KCAhTBI3kKAlLPNCS0X9AlGU/awaxB3/ZFJP1Z
ZMCYM6eJWWrxj6hof9NfriiYpuRz2nnMiNeW8vZqtiTsMT0UiKq9R2TYLVUX9X/V
L98xDCSgezLTn7tA9WABA/QAZ//4Z5XDnA8bd+l6kYZTiXP5YHggiuIi2ZY54HCi
sKhYzLJb2Afb0+XQ8GVJMhZrXjTScBjVmicr1vJv3wary/qWYXvH+4cHfamNvqwq
U1wbsdXgfXpv6G2NTzKkcBYRDDyga1HOaN7q1BnC5R/jcQcgfVX0Ypu5AXcOLTGL
4GtZW0Cg0s64wqgdNRreCeX4VHH1XzOvS217EySRwq6son83c3UVly2YTK9ABHwk
27SaDuZym25uTT5MOsJcza/hKb7fJBSxEx66mglqbw+VoaRS7Ankn/W3zdUMSAHg
Kz6li1RyBSXuFoDH98HcRhaMEIeYF+RvBVyn8jJK8IQfpf0+tGdxEZ4XL0F3muh2
ZNCXXtjtx1p8YAU=
=pPT6
-----END PGP MESSAGE-----

--b23cd7f7--

The resulting message is now essentially opaque. It’s been encrypted using the public keys of the recipients. All of the useful information (the public key of the sender, the signature and the message content) are encrypted. A recipient would use their private key to decrypt the contents.

Conclusion

At Fathom Data we routinely use {emayili} for sending messages from R. This forms a core component of many of our automated workflows. Being able to encrypt those messsages, ensuring that the data we’re sending is secure, is going to be very useful indeed.

I’m very interested in feedback on this new feature. Please give it a try and let me know if there are any issues. If you find this useful, please tweet about and don’t forget to tag @datawookie and @fathomdata.


The {emayili} package is developed & supported by Fathom Data.

To leave a comment for the author, please follow the link and comment on their blog: R - datawookie.

R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.