GPG in the Real World

edunham

October 3, 2015

Me

  • Not fond of mathematics
  • "DevOps Engineer", Mozilla Reasearch
  • Routinely need to share secret information with international colleagues
  • Still have to Google this stuff a lot.

You

  • Heard of GPG?
  • Been to a key signing party?
  • Have a keybase.io account?
  • Feel like you understand these tools?

Acronyms

OpenPGP

  • RFC4880

PGP

  • OpenPGP-compatible

Zimmermann, Philip (1995). PGP Source Code and Internals. MIT Press. ISBN 0-262-24039-4.

GnuPG

  • OpenPGP-compatible

  • No proprietary algorithms

Best Practices

3-5 years

  • RSA-2048 lasts till ~2030
  • (https://www.gnupg.org/faq/gnupg-faq.html)

Threat model

  • Mossad vs Not Mossad
  • https://www.usenix.org/system/files/1401_08-12_mickens.pdf

If you could eavesdrop on everything, which messages would interest you most?

Anatomy of a GPG key

Public Key

Private Key

Key ID

4513F798

Fingerprint

909F 5042 991A 3A32 7BE1  0F7C 4DA5 9C93 4513 F798

Different kinds of keys

RSA

  • Rivest, Shamir, Adleman
  • 1977
  • Patented till 2010

Elgamal

  • 1985
  • Encrypt-only

DSA

  • Digital Signature Algorithm
  • 1993
  • Sign-only

Creating a Key

Why?

Choose your Passphrase

Mark your Calendar

gpg --gen-key

Not enough random bytes available.  Please do some 
other work to give the OS a chance to collect 
more entropy!

Expiration

gpg --list-keys

gpg --edit-key ABCD1234

gpg> list

usage: E means "editing this key"

gpg> expire

gpg> 1y

Maybe

gpg --keyserver pgp.mit.edu --send-keys ABCD1234

Revocation

gpg -o revoke.asc --gen-revoke <key specifier>

Please select the reason for the revocation:
  0 = No reason specified
  1 = Key has been compromised
  2 = Key is superseded
  3 = Key is no longer used
  Q = Cancel
(Probably you want to select 1 here)

Back up that cert.

Working with keys

~/.gnupg

  • Name, email, key ID

Export a public key

gpg --export <key identifier> for binary

gpg --armor --export <key identifier> for ascii

Import someone else's public key

gpg --import thing.gpg

Signing and examining their key

gpg --edit-key <key identifier>

  • gpg> sign
  • gpg> check

Signing

Sign a document

gpg --clearsign doc.txt

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

[...]
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v0.9.7 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iEYEARECAAYFAjdYCQoACgkQJ9S6ULt1dqz6IwCfQ7wP6i/i8HhbcOSKF4ELyQB1
oCoAoOuqpRqEzr4kOkQqHRLE/b8/Rw2k
=y6kj
-----END PGP SIGNATURE-----

gpg --verify doc.txt

Encryption

First, get their key.

gpg --output file.gpg --encrypt --recipient <key identifier> file

Decryption

gpg --decrypt thing.gpg

--output unencrypted.txt

rm unencrypted.txt

extundelete

Quiz

What does a signature (on a message) tell you?

What does encryption tell you?

What does encryption tell everyone else?

What does a signature (on a key) tell you?

What does a key's ID tell you?

Newbie Mistakes

What could go wrong?

Expiration date

Revocation?

Passphrases

Backups

Don't lose your key

What does 'lose' mean?

File permissions

ls -al ~/.gnupg

Test your backups

Back up your passphrase

Secure your laptop

Applications

The Dream

  • Each key maps to at most one user
  • Each user maps to a Real Person

The Trustweb

  • I trust Amanda
  • Amanda trusts Bob.
  • Bob trusts Cat.
  • So I trust Cat, right?
  • Go to a keysigning party.

Do you trust the keyservers?

keybase.io

Links cryptographic identity to online communities

it's convenient

and problematic

and people use it.

Getting someone's key

Threat model

Email them your public key

Email and IRC

Voice/video chat to confirm key fingerprints

Exchange keys in person

GPG In the Wild

Proving Identity of...

  • Individuals
  • Teams
  • Companies

Proving file origin

Sharing Secrets

  • Team collaboration
  • Security/CVE reporting

Teams?!

Let's just share one key!

What happens when someone leaves?

Servers sign files too. Do you trust them?

Subkeys!

https://wiki.debian.org/Subkeys

Delegate some of your key's powers

gpg --edit-key <key identifier> gpg> addkey

Why?

  • Which of my devices signed that?
  • RSA used to be patented

Works great for signing!

Less great for getting encrypted messages

Secret Sharing Schemes!

Let any X of Y keyholders decrypt a secret

Why?

How?

  • gfshare
  • ssss/ssss-combine (for passphrases)