Basics of Cryptography Flashcards
What does a symmetric encryption scheme contain?
- Plaintext: the message that should be securely transmitted
- Encryption Algorithm: the algorithm which scrambles the plaintext
- Secret Key: additional input to the encryption, used to control the scrambling
- Ciphertext: the result of applying the encryption algorithm (with the secret key) to the plaintext
- Decryption Algorithm: inverse of Encryption Algorithm, turning Ciphertext and Secret Key back to the Plaintext
What is the Kerckhoff’s principle?
- Security of a cryptographic algorithm must rely only on secrecy of the key, not the secrecy of the algorithm
- We must assume that the algorithm is public knowledge or can be reconstructed
Caesar Cipher
Encryption rotates all characters three forward
Decryption rotates characters three backward
Not secure by any standard, secret is in the algorithm
General Shift Cipher
Generalization of Caesar’s cipher, k is shift width
-> crack brute force
Substitution Cipher
Key k is substitution table
Encryption of plaintext through lookup in table
Decryption via inverse lookup in table
-> crack through Letter frequencies in English text
-> crack brute force
Vigenère Cipher
Uses a random key of length n
- for each i-th character, shift it by i % n’th position in key (mod 26)
Crack:
- determine key length
-> pick n, conduct frequency analysis for every n-th character
use frequency analysis for each offset in the n-long key
Stream ciphers vs. block ciphers
§ Stream cipher encrypts/decrypt continuous stream of data
- requires a continuous key stream (either OTP or with a generator)
- requires significant amount of state to be exchanged (or kept)
§ Block cipher splits plaintext into fixed-size blocks
- requires single key
- permutes input based on key
- continues with next block
ECB - single bit failure in c(decryption), single bit failure in IV(Decryption), encrypted parallel, random read access
A single corrupted bit in the ciphertext will lead to a complete failure in the same block, because the key will be used on it afterwards. But this will not affect the others.
Nothing will happen since it is not using an IV.
Every block is encrypted with the same key, therefore all of them can be encrypted in parallel. Because the decryption operates the same way, it can also be fully parallel.
Encryption parallelizable: Yes
Decryption parallelizable: Yes
Random read access: Yes
CBC - single bit failure in c(decryption), single bit failure in IV(Decryption), encrypted parallel, random read access
A single corrupted bit in the ciphertext will lead to a complete failure in the same block and will affects one bit in the next plaintext block. Because the key will be used on the ciphertext with the bit failure, as it is only used to XOR after key usage in the next block. The following ones will remain unaltered.
Just a single bit will fail in the first block, because it only effects the XOR and the XOR is only affecting 1 bit. All the other blocks are decrypted without the usage of the IV.
Just one block can be encrypted in the same instance, because the previous encrypted message block is needed in the next message block for the encryption. However, the decryption can be fully parallelised, since only the ciphertext from the previous block is needed for the XOR in the next block and all ciphertexts are known. The key is the same for all blocks.
Encryption parallelizable: No
Decryption parallelizable: Yes
Random read access: Yes
CTR - single bit failure in c(decryption), single bit failure in IV(Decryption), encrypted parallel, random read access
A single corrupted bit in the ciphertext will lead to single bit failure in the same block, as it is just being XORed with the key. All other blocks will remain unaltered.
Every block will break completely since every IV affects the key used in its block.
The encryption can be parallel, since the IV for every block can be generated at the same time. The counter added to each following IV is a known constant and can therefore be calculated. Each IV is then encrypted and used to XOR the message. The same applies to the decryption, because it operates the same way as the encryption.
Encryption parallelizable: Yes
Decryption parallelizable: Yes
Random read access: Yes
Collision Resistant Hash Function (CRHF)
A hash function H is collision resistant if no “efficient” algorithm is known that finds a collision for H in suitable time.
A collision for H is a tuple (m1, m2) with
H(m1) = H(m2) ∧m1 ≠ m2
Hash functions
informally: take as input data of arbitrary length and output data of fixed length n
Preimage resistance (one-way property)
Given a hash value h, it is computationally infeasible to find any m, for which H(m) = h
Second preimage resistance
Given any message m1, it is computationally infeasible to find a message m2 such that m1 ≠ m2 with H(m1) = H(m2)
Avalanche effect in cryptography
A minimal change in the input should result in a significant change in the output
- Strict Avalanche Criterion (SAC): Flip a single bit in the input, every bit in the output should be flipped with 50% probability
Not all cryptographic algorithms have avalanche effect
- Shift and substitution ciphers: only single character is modified in output
When searching for AES, SAC had to be fulfilled by all contestants