Lecture 9: Email Security via PGP CS 436/636/736 Spring 2012 Nitesh Saxena Course Admin • HW3 Posted – Due at 11am Apr 12 (next Thursday) Lecture 9 - Email Security via PGP Email Security • Email is one of the most widely used and regarded network services • By default, email communication is NOT “secure” – may be inspected either in transit, or by suitably privileged users on destination system – may be impersonated/spoofed Lecture 9 - Email Security via PGP Email Security Enhancements • Confidentiality – protection from disclosure • Authentication – of sender of message • Message integrity – protection from modification • Non-repudiation of origin – protection from denial by sender Lecture 9 - Email Security via PGP Pretty Good Privacy (PGP) • Open source, freely available software package for secure e-mail • De facto standard for secure email • Developed by Phil Zimmermann • Selected best available crypto algorithms to use • Runs on a variety of platforms like Unix, PC, Macintosh and other systems • Originally free (now also have commercial versions available) Lecture 9 - Email Security via PGP PGP Operation – Authentication Just use digital signatures: 1. 2. 3. 4. Sender creates message Generates a digital signature for the message Use SHA-1 to generate 160-bit hash of message Signed hash with RSA (or DSA) using sender's private key, and is attached to message 5. Receiver uses RSA (or DSA) with sender's public key to decrypt and recover hash code 6. Receiver verifies received message using hash of it and compares with decrypted hash code Lecture 9 - Email Security via PGP PGP Operation – Confidentiality 1. Sender generates a message 2. Generates a128-bit random number as session key 3. Encrypts the message using CAST-128 / IDEA / 3DES in CBC mode with session key 4. Session key encrypted using RSA with recipient's public key and attached to the msg 1. Can also use El Gamal 5. Receiver uses RSA with private key to decrypt and recover session key 6. Session key is used to decrypt message Lecture 9 - Email Security via PGP PGP Operation – Confidentiality & Authentication • Can use both services on the same message – create signature & attach it to the message – encrypt both message & signature – attach RSA (or El Gamal) encrypted session key This sequence is preferred because --one can store the plaintext message/file and its signature --no need to decrypt the message/file again and again Lecture 9 - Email Security via PGP PGP Operation – Compression • PGP compresses messages to save space for e-mail transmission and storage • By default, PGP compresses message after signing but before encrypting – so can store uncompressed message & signature for later verification – Encryption after compression strengthens security (because compression has less redundancy) • uses ZIP compression algorithm Lecture 9 - Email Security via PGP PGP Operation – Email Compatibility • When using PGP will have binary data (8-bit octets) to send (encrypted message, etc) • However, email was designed only for text • Hence PGP must encode raw binary data into printable ASCII characters • uses radix-64 algorithm – maps 3 bytes to 4 printable chars – also appends a CRC • PGP also segments messages if too big (maximum length 50,000 octets) Lecture 9 - Email Security via PGP PGP Operation – Summary Lecture 9 - Email Security via PGP PGP Session Keys • Need a session key for each message – of varying sizes: 56-bit DES, 128-bit CAST or IDEA, 168-bit Triple-DES • Uses random inputs taken from – actual keys hit – keystroke timing of a user – mouse movement Lecture 9 - Email Security via PGP PGP Public & Private Keys • Since many public/private keys may be in use, need to identify which is actually used to encrypt session key in a message – Could send full public-key with every message – But, this is inefficient • Rather use a key identifier based on key – is least significant 64-bits of the key – will very likely be unique • also use key ID in signatures Lecture 9 - Email Security via PGP PGP Key Rings • each PGP user has a pair of keyrings: – public-key ring contains all the public-keys of other PGP users known to this user, indexed by key ID – private-key ring contains the public/private key pair(s) for this user, indexed by key ID & encrypted keyed from a hashed passphrase • security of private keys thus depends on the pass-phrase security Lecture 9 - Email Security via PGP PGP Message Format Lecture 9 - Email Security via PGP PGP Message Generation Lecture 9 - Email Security via PGP PGP Message Reception Lecture 9 - Email Security via PGP PGP Key Distribution • Public keys for encrypting session keys / verifying signatures. • Private keys for decrypting session keys / creating signatures. • Where do these keys come from and on what basis can they be trusted? Lecture 9 - Email Security via PGP PGP Key Distribution • PGP adopts a trust model called the web of trust. • No centralized authority • Individuals sign one another’s public keys, these “certificates” are stored along with keys in key rings. • PGP computes a trust level for each public key in key ring. • Users interpret trust level for themselves. Lecture 9 - Email Security via PGP PGP Key Distribution Issues • Original intention was that all e-mail users would contribute to web of trust. • Reality is that this web is sparsely populated. • How should security-unaware users assign and interpret trust levels? • Later versions of PGP support X.509 certs. Lecture 9 - Email Security via PGP PGP in Practice • PGP plugins available – Standalone Email clients – Browser (e.g., FireGPG) Lecture 9 - Email Security via PGP Summary • have considered: – secure email – PGP Lecture 9 - Email Security via PGP References • Chapter 18 of Stallings Lecture 9 - Email Security via PGP