CPSC 426/526 Cryptographic Systems Ennan Zhai Computer Science Department Yale University
Recall: Lec-10 In lec-10, we learned: - Consistency models - Two-phase commit - Consensus - Paxos
Lecture Roadmap Cryptographic Basics Symmetric-Key Cryptography Public-Key Cryptography Hash Functions Case Study: CryptDB
Cryptography Cryptography may be a component of a secure system Adding cryptography may not make a system secure If a system supports the stronger consistency model, then the weaker Authentication consistency model is automatically supported. But - determine stronger consistency origin of message models sacrifice more availability and fault tolerance. Integrity - verify that message has not been modified Confidentiality - others cannot read contents of the message
Terms Plaintext (cleartext) message M Encryption E(M) Produces Ciphertext, C = E(M) Decryption M = D(C)
Lecture Roadmap Cryptographic Basics Symmetric-Key Cryptography Public-Key Cryptography Hash Functions Case Study: CryptDB
Symmetric-Key Algorithm Known algorithm but we introduce a secret parameter: key Same secret key, K, for encryption & decryption - C = EK(M) and M = DK(C) Examples: AES, 3DES, IDEA, RC5 Key length - DES: 56-bit key: 2 56 = 7.2 x 10 16 keys - AES-256: 256-bit key 2 256 = 1.1 x 10 77 keys
Communicating with symmetric crypto Both parties must agree on a secret key: K Message is encrypted, sent, decrypted at other side Key distribution must be secret - otherwise messages can be decrypted - users can be impersonated
Key Explosion
Key Distribution Secure key distribution is the biggest problem with symmetric cryptography
Diffie-Hellman Key Exchange Protocol was proposed in 1976 Won Turing Award in 2005
Diffie-Hellman Key Exchange Key distribution algorithm - First algorithm to use public/private keys - Not public key encryption - Uses a one-way function: Based on difficulty of computing discrete logarithms in a finite field compared with ease of calculating exponentiation Allows us to negotiate a secret common key without fear of eavesdroppers
Diffie-Hellman Key Exchange Both parties agree on a large prime number p and a number a < p Each party generates a public/private key pair
Diffie-Hellman Key Exchange Both parties agree on a large prime number p and a number a < p Each party generates a public/private key pair One-way function: - Easy to compute in one direction - Difficult to compute in the other
Diffie-Hellman Key Exchange Both parties agree on a large prime number p and a number a < p Each party generates a public/private key pair One-way function: - Easy to compute in one direction - Difficult to compute in the other
Diffie-Hellman Key Exchange
Diffie-Hellman Key Exchange
Diffie-Hellman Key Exchange
Diffie-Hellman Key Exchange K is a common key, known only to Bob and Alice
Lecture Roadmap Cryptographic Basics Symmetric-Key Cryptography Public-Key Cryptography Hash Functions Case Study: CryptDB
Public-Key Cryptography In public-key cryptographic system - Each user generates two keys: private key and public key - Private key is used to keep secret - Public key can be shared with anyone - Algorithm based on the difficulty of factoring large number
Public-Key Cryptography
Public-Key Cryptography Examples - RSA and Elliptic curve algorithms - DSS (digital signature standard) Different keys for encrypting and decrypting - No need to worry about key distribution - Share public keys - Keep private keys secret
Public-Key Cryptography Examples - RSA and Elliptic curve algorithms - DSS (digital signature standard) Different keys for encrypting and decrypting - No need to worry about key distribution The first public-key - Share public keys algorithm - Keep private keys secret
Public-Key Cryptography
Public-Key Cryptography
Hybrid Cryptosystems Session key: randomly-generated key for one communication session Use a public key algorithm to send the session key Use a symmetric algorithm to encrypt data with the session key
Lecture Roadmap Cryptographic Basics Symmetric-Key Cryptography Public-Key Cryptography Hash Functions Case Study: CryptDB
Hash Functions Cryptographic hash function - Input: arbitrary data - Output: fixed-length bit string Many usages - Data lookup (e.g., in Chord) - Data integrity -......
Hash Functions Properties One-way function - Given H=Hash(M), it should be difficult to compute M, given H Collision resistant - Given H=Hash(M), it is difficult to find M, so that H=Hash(M ) - For a hash of length L, a perfect hash would take 2 (L/2) attempts Efficient - Computing a hash function should be computationally efficient
Hash Functions Properties One-way function - Given H=Hash(M), it should be difficult to compute M, given H Collision resistant - Given H=Hash(M), it is difficult to find M, so that H=Hash(M ) - For a hash of length L, a perfect hash would take 2 (L/2) attempts This Efficient property ensures a hash function can be used as fingerprint - Computing a hash function should be computationally efficient
Popular Hash Functions MD4 and MD5 SHA-1, SHA-2, SHA-3 and SHA-256
Lecture Roadmap Cryptographic Basics Symmetric-Key Cryptography Public-Key Cryptography Hash Functions Case Study: CryptDB
Next Lecture In the lec-12, I will cover: - What is differential privacy and why we need it - DJoin - Midterm review