email security pgp / pretty good privacy · 2018. 11. 29. · pgp vs gpg vs openpgp ... –...

51
1 Crypto application: PGP (Pretty Good Privacy)

Upload: others

Post on 16-Sep-2020

5 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Email Security PGP / Pretty Good Privacy · 2018. 11. 29. · PGP vs GPG vs OpenPGP ... – Thunderbird with Enigmail (follow the slides) • Send Signed/Encrypted email (follow the

1

Crypto application:

PGP (Pretty Good Privacy)

Page 2: Email Security PGP / Pretty Good Privacy · 2018. 11. 29. · PGP vs GPG vs OpenPGP ... – Thunderbird with Enigmail (follow the slides) • Send Signed/Encrypted email (follow the

PGP vs GPG vs OpenPGP

• Pretty Good Privacy (PGP) written by Phil Zimmerman and released in 1991

• OpenPGP is an IETF standard with which both pieces of software are compliant

• Gnu Privacy Guard (GPG) similar software released in 1999 under the GPL open source license.– Based on the OpenPGP standards

2

Page 3: Email Security PGP / Pretty Good Privacy · 2018. 11. 29. · PGP vs GPG vs OpenPGP ... – Thunderbird with Enigmail (follow the slides) • Send Signed/Encrypted email (follow the

Security issues for E-mail• Confidentiality

– Sys Admin, Email provider can read– Could be captured and read by anyone on your LAN

• Integrity– contents could be changed by anyone on the network.

• Authenticity– Easy to insert any e-mail header: “From”– Difficult to know if it was sent by the “Sender”

Page 4: Email Security PGP / Pretty Good Privacy · 2018. 11. 29. · PGP vs GPG vs OpenPGP ... – Thunderbird with Enigmail (follow the slides) • Send Signed/Encrypted email (follow the

Targeted Attack - Recap

• Targeting a specific organization/group or person

• Email with malicious attachments– Executable– Word document

Page 5: Email Security PGP / Pretty Good Privacy · 2018. 11. 29. · PGP vs GPG vs OpenPGP ... – Thunderbird with Enigmail (follow the slides) • Send Signed/Encrypted email (follow the

Targeted AttackTo: your e-mail address

From: Fakrul Alam [email protected]

Subject: my request

Hello,

I have been looking for someone who can answer questions in the attached file. I hope you can help me.

Thanks !

Page 6: Email Security PGP / Pretty Good Privacy · 2018. 11. 29. · PGP vs GPG vs OpenPGP ... – Thunderbird with Enigmail (follow the slides) • Send Signed/Encrypted email (follow the

Example of Spoof Mail

Page 7: Email Security PGP / Pretty Good Privacy · 2018. 11. 29. · PGP vs GPG vs OpenPGP ... – Thunderbird with Enigmail (follow the slides) • Send Signed/Encrypted email (follow the

Cryptography - PGP

• PGP is based on asymmetric (public-key) encryption

Page 8: Email Security PGP / Pretty Good Privacy · 2018. 11. 29. · PGP vs GPG vs OpenPGP ... – Thunderbird with Enigmail (follow the slides) • Send Signed/Encrypted email (follow the

Asymmetric Encryption Recap

• Solves the problem of securely sharing (generating) secret keys and key explosion

• Public and private key mathematically related to each other– Cannot derive one from the other

• Encrypt with one and decrypt with the other– Encrypt with private, only public can decrypt– Encrypt with public, only private can decrypt

Page 9: Email Security PGP / Pretty Good Privacy · 2018. 11. 29. · PGP vs GPG vs OpenPGP ... – Thunderbird with Enigmail (follow the slides) • Send Signed/Encrypted email (follow the

Signing & Encrypting

• Data can be signed with private key to be verified by anyone who has the public key– Remember digital signature?– Does not always have to be hash and encrypt!

• Since public keys are also data, they can be signed too!– Digital Certificates?

Page 10: Email Security PGP / Pretty Good Privacy · 2018. 11. 29. · PGP vs GPG vs OpenPGP ... – Thunderbird with Enigmail (follow the slides) • Send Signed/Encrypted email (follow the

How PGP Works

Encrypt with receiver’s public key

Sign with sender’s

private key 🔐🔐Document Signed & Encrypted

document

🔐🔐🔐🔐

Decrypt with local private key

Verify (decrypt) with sender’s

public key

Document Signed & Encrypted document

SENDER

RECEIVER

Page 11: Email Security PGP / Pretty Good Privacy · 2018. 11. 29. · PGP vs GPG vs OpenPGP ... – Thunderbird with Enigmail (follow the slides) • Send Signed/Encrypted email (follow the

Trust

• Chain of Trust (centralized/hierarchical)– Certain globally trusted bodies sign the public keys for

everyone

• Web of Trust (decentralized)– You pick whom you trust, and decide if you trust who they

trust

• Helps verify/associate a public key to an individual

• Which one is better?

Page 12: Email Security PGP / Pretty Good Privacy · 2018. 11. 29. · PGP vs GPG vs OpenPGP ... – Thunderbird with Enigmail (follow the slides) • Send Signed/Encrypted email (follow the

Sample Web of Trust

Alice

Bob

Eve

Tashi

Carlos

• You can share your “trust-information” by publishing someone’s public key with your PGP sign – signed with your private key

Page 13: Email Security PGP / Pretty Good Privacy · 2018. 11. 29. · PGP vs GPG vs OpenPGP ... – Thunderbird with Enigmail (follow the slides) • Send Signed/Encrypted email (follow the

PGP by GnuPG

• Create your keys– Public and Private keys

• Identify a key by– Key ID (like 0x23AD8EF6)

• Verify someone’s public key by– Key fingerprint

• Find public keys on public key servers– Like http://pgp.mit.edu

Page 14: Email Security PGP / Pretty Good Privacy · 2018. 11. 29. · PGP vs GPG vs OpenPGP ... – Thunderbird with Enigmail (follow the slides) • Send Signed/Encrypted email (follow the

Key Management

• Use graphical tools– GPG Keychain for OS X– Kleopatra/GPA for Windows

• Use the command linegpg --list-keys

Page 15: Email Security PGP / Pretty Good Privacy · 2018. 11. 29. · PGP vs GPG vs OpenPGP ... – Thunderbird with Enigmail (follow the slides) • Send Signed/Encrypted email (follow the

Key Management

• On printed media– Business cards

• Digital– Email– Sneakernet

• Online– OpenPGP key servers (pgp.mit.edu)

• But does not say anything about whether you trust a key

Page 16: Email Security PGP / Pretty Good Privacy · 2018. 11. 29. · PGP vs GPG vs OpenPGP ... – Thunderbird with Enigmail (follow the slides) • Send Signed/Encrypted email (follow the

Key Management

• Make sure you specify the expiry (validity period)– Ensures that in case your private key is compromised, the

key-pair can only be used until it expires

• The expiry period can be changed anytime after creating the key

• However, before a key-pair expires, it is important you create a new key pair, sign it with the old one, and publish the signed new key to everyone in your web of trust– So that they can sign your new key

Page 17: Email Security PGP / Pretty Good Privacy · 2018. 11. 29. · PGP vs GPG vs OpenPGP ... – Thunderbird with Enigmail (follow the slides) • Send Signed/Encrypted email (follow the

Key Management - Revocation

• Used to mark a key as invalid– Either before an expiry, or– If the private key has been compromised

• Always generate a revocation certificate as soon as you create your key– Don’t keep you revocation cert together with your private

key– gpg --gen-revoke IDENTITY

Page 18: Email Security PGP / Pretty Good Privacy · 2018. 11. 29. · PGP vs GPG vs OpenPGP ... – Thunderbird with Enigmail (follow the slides) • Send Signed/Encrypted email (follow the

Key Management - Partying

• Key signing parties– To build your web of trust

• Each participant carries some form of ID, and a copy of their key fingerprint

– and maybe some 🍻🍻

• Each participant decides whether to sign someone’s keys– Based on their personal policies

Page 19: Email Security PGP / Pretty Good Privacy · 2018. 11. 29. · PGP vs GPG vs OpenPGP ... – Thunderbird with Enigmail (follow the slides) • Send Signed/Encrypted email (follow the

How PGP Works

• To check your GPG version

Page 20: Email Security PGP / Pretty Good Privacy · 2018. 11. 29. · PGP vs GPG vs OpenPGP ... – Thunderbird with Enigmail (follow the slides) • Send Signed/Encrypted email (follow the

How PGP Works

• Use “gpg --help” or “man gpg”

Page 21: Email Security PGP / Pretty Good Privacy · 2018. 11. 29. · PGP vs GPG vs OpenPGP ... – Thunderbird with Enigmail (follow the slides) • Send Signed/Encrypted email (follow the

Generate Public-Private key pair

• Create the GPG public-private key pair

• We will opt for the default algorithm: RSA and RSA

Page 22: Email Security PGP / Pretty Good Privacy · 2018. 11. 29. · PGP vs GPG vs OpenPGP ... – Thunderbird with Enigmail (follow the slides) • Send Signed/Encrypted email (follow the

Generate Public-Private key pair

• We will opt for 2048 bits

It is important to select key expiry period• You do not want a key that never expires• Many organizations operate with a 1 year key validity• Need to inform others when you change your keys

Page 23: Email Security PGP / Pretty Good Privacy · 2018. 11. 29. · PGP vs GPG vs OpenPGP ... – Thunderbird with Enigmail (follow the slides) • Send Signed/Encrypted email (follow the

Generate Public-Private key pair

• Type your name and email address– Along with the comment will be used as USER-ID

Anyone can generate keys with your email!How can you identify your key uniquely?• Fingerprint!

Page 24: Email Security PGP / Pretty Good Privacy · 2018. 11. 29. · PGP vs GPG vs OpenPGP ... – Thunderbird with Enigmail (follow the slides) • Send Signed/Encrypted email (follow the

Generate Public-Private key pair

Page 25: Email Security PGP / Pretty Good Privacy · 2018. 11. 29. · PGP vs GPG vs OpenPGP ... – Thunderbird with Enigmail (follow the slides) • Send Signed/Encrypted email (follow the

Generate Public-Private key pair

• GPG will create the key pair

Read the messages carefully and take note of the contents:• Key ID• Key Fingerprint• Expiry• User ID

Page 26: Email Security PGP / Pretty Good Privacy · 2018. 11. 29. · PGP vs GPG vs OpenPGP ... – Thunderbird with Enigmail (follow the slides) • Send Signed/Encrypted email (follow the

Generate Public-Private key pair

• List your keys:

Page 27: Email Security PGP / Pretty Good Privacy · 2018. 11. 29. · PGP vs GPG vs OpenPGP ... – Thunderbird with Enigmail (follow the slides) • Send Signed/Encrypted email (follow the

Sign data & verify

• Create a file for signing

• Sign the data (type the passphrase)

Page 28: Email Security PGP / Pretty Good Privacy · 2018. 11. 29. · PGP vs GPG vs OpenPGP ... – Thunderbird with Enigmail (follow the slides) • Send Signed/Encrypted email (follow the

Sign data & verify

• Have a look inside the signed file

Page 29: Email Security PGP / Pretty Good Privacy · 2018. 11. 29. · PGP vs GPG vs OpenPGP ... – Thunderbird with Enigmail (follow the slides) • Send Signed/Encrypted email (follow the

Sign data & verify it

• ”Good signature from” indicates that the file was signed by the private key correctly

• The “WARNING” message is because we signed it as a cleartext signature – cleartext signature is readable without any special tool– If signed as a detached signature (--detach-sign), it would

create a separate file just for the signature

Page 30: Email Security PGP / Pretty Good Privacy · 2018. 11. 29. · PGP vs GPG vs OpenPGP ... – Thunderbird with Enigmail (follow the slides) • Send Signed/Encrypted email (follow the

Export key (public)

• You can export a key to a file– for backup or further submission to public key servers

• The -a option generates the output in ASCII format

Page 31: Email Security PGP / Pretty Good Privacy · 2018. 11. 29. · PGP vs GPG vs OpenPGP ... – Thunderbird with Enigmail (follow the slides) • Send Signed/Encrypted email (follow the

Export key (public) – key server• You can either use the CLI:

– Need to specify the key ID

– You can also specify a key server

• Or submit the keys (ASCII) directly on a key server

Page 32: Email Security PGP / Pretty Good Privacy · 2018. 11. 29. · PGP vs GPG vs OpenPGP ... – Thunderbird with Enigmail (follow the slides) • Send Signed/Encrypted email (follow the

Find keys – key server

Page 33: Email Security PGP / Pretty Good Privacy · 2018. 11. 29. · PGP vs GPG vs OpenPGP ... – Thunderbird with Enigmail (follow the slides) • Send Signed/Encrypted email (follow the

Import keys (public)

• You can import keys in a file

• Or import from public key servers

• Find the imported key

Page 34: Email Security PGP / Pretty Good Privacy · 2018. 11. 29. · PGP vs GPG vs OpenPGP ... – Thunderbird with Enigmail (follow the slides) • Send Signed/Encrypted email (follow the

Verify the fingerprint

• Make sure to verify the fingerprint of every imported key

Page 35: Email Security PGP / Pretty Good Privacy · 2018. 11. 29. · PGP vs GPG vs OpenPGP ... – Thunderbird with Enigmail (follow the slides) • Send Signed/Encrypted email (follow the

Signing keys• You can sign someone’s public key (trust)

• Make sure you verify their key fingerprint and any form of identification

Page 37: Email Security PGP / Pretty Good Privacy · 2018. 11. 29. · PGP vs GPG vs OpenPGP ... – Thunderbird with Enigmail (follow the slides) • Send Signed/Encrypted email (follow the

Publishing signed keys• You can now push the signed key to public key

server– Publishing your web of trust

• Verify on the key server

Page 38: Email Security PGP / Pretty Good Privacy · 2018. 11. 29. · PGP vs GPG vs OpenPGP ... – Thunderbird with Enigmail (follow the slides) • Send Signed/Encrypted email (follow the

Encrypt Message• You must have the public keys of the intended

recipient– Create a file to encrypt

– Sign (with your private key) and Encrypt (with recipient’s public key) the file

Page 39: Email Security PGP / Pretty Good Privacy · 2018. 11. 29. · PGP vs GPG vs OpenPGP ... – Thunderbird with Enigmail (follow the slides) • Send Signed/Encrypted email (follow the

Decrypt Message

• Try to read the encrypted message

Page 40: Email Security PGP / Pretty Good Privacy · 2018. 11. 29. · PGP vs GPG vs OpenPGP ... – Thunderbird with Enigmail (follow the slides) • Send Signed/Encrypted email (follow the

Decrypt Message

• Decrypt the file

– The file was:• Signed with [email protected]’s private key• encrypted with [email protected]’s public key

Page 41: Email Security PGP / Pretty Good Privacy · 2018. 11. 29. · PGP vs GPG vs OpenPGP ... – Thunderbird with Enigmail (follow the slides) • Send Signed/Encrypted email (follow the

References:

• https://www.gnupg.org/gph/en/manual/book1.html

Page 42: Email Security PGP / Pretty Good Privacy · 2018. 11. 29. · PGP vs GPG vs OpenPGP ... – Thunderbird with Enigmail (follow the slides) • Send Signed/Encrypted email (follow the

Lab Exercise

42

Page 43: Email Security PGP / Pretty Good Privacy · 2018. 11. 29. · PGP vs GPG vs OpenPGP ... – Thunderbird with Enigmail (follow the slides) • Send Signed/Encrypted email (follow the

Lab Exercise - 1

• Download and install PGP software– Windows: gpg4Win (https://www.gpg4win.org)– OS X: GPG Suite (https://www.gpgtools.org)

Page 44: Email Security PGP / Pretty Good Privacy · 2018. 11. 29. · PGP vs GPG vs OpenPGP ... – Thunderbird with Enigmail (follow the slides) • Send Signed/Encrypted email (follow the

Lab Exercise - 2

• Generate and publish key pair– Windows: Follow the lab manual pgp-lab.pdf– OS X/Linux: Follow the slide

Page 45: Email Security PGP / Pretty Good Privacy · 2018. 11. 29. · PGP vs GPG vs OpenPGP ... – Thunderbird with Enigmail (follow the slides) • Send Signed/Encrypted email (follow the

Lab Exercise - 3

• Setup mail client:– Thunderbird with Enigmail (follow the slides)

• Send Signed/Encrypted email (follow the slides)

Page 46: Email Security PGP / Pretty Good Privacy · 2018. 11. 29. · PGP vs GPG vs OpenPGP ... – Thunderbird with Enigmail (follow the slides) • Send Signed/Encrypted email (follow the

Thunderbird with Enigmail• Download and install Thunderbird

– Add Enigmail (Tools > Add-ons)– Restart Thunderbird

Page 47: Email Security PGP / Pretty Good Privacy · 2018. 11. 29. · PGP vs GPG vs OpenPGP ... – Thunderbird with Enigmail (follow the slides) • Send Signed/Encrypted email (follow the

Thunderbird with Enigmail

• Setup Enigmail

Page 48: Email Security PGP / Pretty Good Privacy · 2018. 11. 29. · PGP vs GPG vs OpenPGP ... – Thunderbird with Enigmail (follow the slides) • Send Signed/Encrypted email (follow the

Thunderbird with Enigmail

• Setup Enigmail– Select the key-pair you generated earlier

Page 49: Email Security PGP / Pretty Good Privacy · 2018. 11. 29. · PGP vs GPG vs OpenPGP ... – Thunderbird with Enigmail (follow the slides) • Send Signed/Encrypted email (follow the

Thunderbird with Enigmail

• Setup Enigmail

Page 50: Email Security PGP / Pretty Good Privacy · 2018. 11. 29. · PGP vs GPG vs OpenPGP ... – Thunderbird with Enigmail (follow the slides) • Send Signed/Encrypted email (follow the

Thunderbird with Enigmail

• Send signed email

Page 51: Email Security PGP / Pretty Good Privacy · 2018. 11. 29. · PGP vs GPG vs OpenPGP ... – Thunderbird with Enigmail (follow the slides) • Send Signed/Encrypted email (follow the

Thunderbird with Enigmail

• Send signed and encrypted email– You will need the public key of the recipient