All things crypto Flashcards
What is the high level goal of cryptography? How is this split this into sub-examples?
The common goal: don’t let the attacker learn anything about the contents of the messages and don’t let them tamper with them either.
1) Protecting data in motion (from client to server or vice versa)
2) Protecting files at rest
What are the 3 main security goals of cryptography?
1) Confidentiality: Attacker cannot know or learn about the contents of the data
2) Integrity: the attacker cannot modify data
3) Authentication: the attacker cannot spoof/make someone believe the message was sent by someone else
What is Symmetric encryption?
Symmetric encryption uses the same key for encrypting and decrypting data. This key must be pre-shared to both parties
Explain what a Cipher is
A form of symmetric encryption. There is encryption and decryption algorithm that uses the same key (K) to turn plaintext message (m) to ciphertext message (c).
Encrypt(K, m) = c
Decrypt(K, c) = m
What is the difference between a passive attacker and active attacker in cryptography? What might their goals be?
Passive: can see the ciphertexts but cannot modify them. Goal: learn something, anything about the plaintext simply from the ciphertexts
Active: Everything that a passive attacker can do, but they can also modify the ciphertexts!! (inject their own ciphertexts, reorder + delete) , AKA, MITM attacker (man in the middle)
What are the requirements of a secure cipher?
1) Correctness: the decrypt algorithm must reveal the same, original plaintext message
2) confidentiality: the ciphertext on its own will reveal nothing about its plaintext (besides maybe the message length)
What is the ROT13 (aka “Caesar cipher”)?
Encrypt(K, m): shift each letter of plaintext over by K positions in the alphabet
Ex: Plaintext: “DEFGH” becomes ciphertext: “FGHKL”
What is the Substitution Cipher? Is it secure?
Encrypt(K, m): K is a permutation on the alphabet. Apply this permutation on each letter
This is not secure because the distribution of English letters is uneven (vowels appear more, etc) so (given a long enough message) you can easily guess what each corresponding letter is based on the frequencies.
What is Kerckhoff’s Principle?
To evaluate the secrurity of crypto algorithms: Assumes the attacker knows all the algorithms and how they are implemented. The only thing unknown is the key
What is a OTP? What are its properties? Is it secure?
Where the plaintext m is length L, the key k is also a bitstring of length L.
Encrypt(K, m) : output k ^ m = c
Decrypt(K, c) : output k ^ c = m
proof: k ^ c = k ^ (k ^ m) = (k ^ k) ^ m = m
OTP in itself is very secure (only thing attacker knows is the length of message), but hard in practice for very long messages
What are 2 techniques we have adopted to use OTPs in practice?
Stream cipher and nonces
How do we define our SECURE encryption goal?
The enryption must hide all partial information about plaintexts. If an attack succeeds without a key, the encryption algorithm is INSECURE
Why is it insecure to re-use a OTP? Are there any real-life examples?
Let’s say we have m1, m2 that both turn into c1, c2 using the SAME OTP K.
c1 ^ c2 = m1 ^ m2… we can use crib-dragging to slowly obtain pieces of the messages! Once we have one full message, we can get a full break.
Real attack: Project Venona in the 1940s on Soviet encryption via US
Explain how Stream Ciphers work and what OTP issue they solve. What is its security goal? Is it secure? What are possible attacks?
Take a small secret key k, and plug it into the stream function: G(). G(k) = large key stream. Essentially use G(small key) = OTP.
This solves the OTP issue of keys being too long. Now we can encrypt long messages with small key.
G(small key) needs to look random. Stronger requirment: passes statistical tests
Brute force attack: given our “OTP” from G(small key), try to plug in all values of k to try and get our “OTP”. then decrypt it with small key
What is RC4 (Ron’s Cipher #4)?
RC4 is a stream cipher from 1987. It is INSECURE.
What is ChaCha20?
A stream cipher from 2007. supports nonces. SECURE
Can you reuse a pad with Stream Ciphers?
NO. Insecure
Explain what nonces are.
To support pad reusing, we can use stream cipher + nonce. Now, our G(key) algorithm takes G(key, nonce) = OTP. Nonce is very small, we only have to replace this.
Again, G(nonce, key) needs to look “random” especially in the context of the nonce
Reusing nonce = reusing pad.