Cryptography
Definition
notation, variable definitions
key - can be secret or public
cipher
message, plaintext
randomized key generator
(often randomized) encryption algorithm
decryption algorithm
encryption Scheme
key space,
message space,
ciphertext space, .
tag space,
random variable over space
random variable over space
random variable over space
Each random variable has its own probability distribution. (We only consider non-zero probability to all elements of each space).
Symmetric vs. Asymmetric
Symmetric
fast
based on heuristics (no proofs)
1 key per user-pair (lots of keys)
must be kept a secret by both ends
Examples
-
AES, based on Rijndael Cipher
STANDARD
-
electronik cook-book ECB
ALWAYS AVOID
- cipherblock chaining BC
- cipher feedback CFB
- output feedback OFB
- countermode CTR
-
AES, based on Rijndael Cipher
Asymmetric
slow
Based on security proofs
One for all users
only must be kept a secret
Examples
- CBC-MAC (similar to block cipher)
has 2 keys, would otherwise be vulnerable
MAC vs. Digital Signature
Both are similar in that they provide message integrity : attacker cannot change message, ie. generate any valid pair
Message Authentication Code MAC
- Symmetric
- Same key used to sign and verify
Digital signature
- Asymmetric
- for signature, for verification
- public verifiability through
- non-repudation: only signer has , can not deny having signed (legal evidence)
Hash Functions
(any message always mapped to a hash with the same size)
ie: MD5 (broken), SHA1 (broken), SHA2 family, SHA3 family,
One-way functions Easy to compute output, infeasible to find the input from output
Collision-resistance Infeasible to find different inputs that map to the same output
called collision-resistant-hash-function CRHF
Collision
Attack Models
Passive Attack
Ciphertext only Observation of ciphertexts
Known plaintext Observation of plaintexts
Active Attacks
Chosen plaintext CPA Access to encryption algorithm
Chosen ciphertext CCA Access to decryption algorithm
Perfect Secrecy of Ciphers
= information theoretic security of encryption schemes
Perfect Secrecy
Cipher should reveal nothing about plaintext .
If for any probability distribution over with random Variable :
That means: cipher occurence = message occurence
Proof: For perfect secrecy we need
Assume uniformly distributed with any :
(= set of's that can be decoded to)
If then
Therefore the message could not occur - no perfect secrecy.
____________
Symmetric Encryption
(Syntactic) Correctness of symmetric encryption(for all examples)
Ancient example: Substitution Cipher / Caesar Encryption
Cyphertext-only-attack: Letter, letter-pair frequency analysis
One-Time-Pad OTP
fast encryption and decryption
perfect secrecy
the key must be as long as the message (key size = message size, requires too much storage)
needs generation of lots of true-randomness
Definition
All spaces are n-bit boolean strings.
(k.length = m.length)
Proof of perfect secrecy
(just a property of)
(is the number of all possible keys / values of random variable)
Important: Key must be used once for entire
To save storage, one might try to split up in smaller pieces and encrypt them with the same .
which is vulnerable to frequency analysis.
Stream Cipher
Pseudo random number generator PRG
Small bit sequence Large pseudorandom bit sequence (by Linear Feedback Shift Register LSFR)
To be secure the seed should be private and truly random (not chosen from a known message part like the email header)
Randomness in practice
Weak:
- throwing coin
- data from load / system parameters
Stronger:
- physical processes
- thermal noise, air perturbation XORed, hashed
Even Stronger:
- Truely random seed for unpredictable PRG, with added entropy
Stream Cipher
means no perfect secrecy because PRG is not truly random.
Stream Cipher usage
- Generate a truly random seed, send with asymmetric encryption (using of receiver)
- Then use PRG from that point on
No integrity for OTP and Stream Cipher
We perserve confidentiality but not the integrity.
Example:
Voting system, where a vote , and we have result-predictions.
(flips votes)
Message Authentication Code MAC
randomized key generation algorithm
(often randomized) signing / encryption algor. that generates a tag
verification algorithm (the decryption algorithm would takenot)
Used to provide message integrity: attacker cannot change message, ie. generate any valid pair
Correctness
____________
Asymmetric Encryption
Public-Key Encryption
randomized key generation algorithm
(often randomized) encryption algorithm
decryption algorithm
Correctness
CPA-Security
Ciphertext indistinguishability under CPA(= Chosen Plaintext attack) for any public-key-encryption.
An experiment between challenger and adversary / attacker:
- Generate a key pair, send to attacker (attacker has access to encryption algorithm - but it is usually randomized)
- Receive from attacker
- Randomly choose one of them, encrypt it and send it back
Attacker should only be able to guess which of the two messages he received of the time.
Definition
= number of attackers attempty / "security parameter" that is bounded polynomially
= experiment where the challenger chose
A series of ciphers under a CPA-attack is indistinguishable if for all adversaries if the following expression is very small:
The probability that attacker chosewhile reality isvs. the opposite.
1-CPA
This extension does not strengthen the definition - he already had access to encryption algorithm.
- Generate key pair, send to attacker
- Receive from attacker and immediately return it in the encrypted form (encryption algorithm is usually randomized)
- previous experiment from this point
ElGamal Encryption Scheme
Example for public key encryption - within
pick random and prime - for
-is private and can not be computed feasibly
pick random
return
received
return
Correctness
Proof of Correctness
ElGamal has CPA security if the DDH Decisional Diffie-Hellman Assumption assumption holds in .
Decisional Diffie-Hellman Assumption
(= One can not compute the discrete logarithm in polynomially bounded= inattempts).
and we choose random .
With given we can not decide whether for any .
Proof by contradiction
We can break ElGamal if we can break the DDH assumption.
If algorithm that breaks ElGamal with any then we imitate the challenger to break DDH with his advantage of distinguishing correctly.
We haveand want to know whether
-
Generate keys:
and sendto.
-
receive
randomly choose one and encrypt with
.
return
-
Receive attackers guess
of
.
(which is correct because of his advantage)
If
If means it was just a random number.
Naive RSA
Also called "textbook RSA" because it is simplified - but not secure.
-
Pick two random primes
calculate (size of set where all elements have an inverse)
-
Choose an random
so that it has an inverse in
has an inverse inbut does not necessarily one in.
in
return key pair
You can not figure outjust fromandunless you know- this is a simplified version.
Encryption
return cipher in.
Decryption
return in.
Correctness
Decryption:
in
What still needs to be proven:
We know thatin- but what about? See below.
This version is insecure: No randomization of
Not secure against passive attacks because it is deterministic.
Same messages result in the same ciphers:
Secure usage of RSA
- big public key length with high strength.
- Preprocessing, padding
- no sidechannels for timing
Proof of Correctness
Chinese remainder theorem CRT
Let be primes and .
Two numbers are equal in they are also equal in and .
Proof of Correctness
has an inverse in , now we want to prove that it also has an inverse in .
It is sufficient to prove that in and .
case 1:
then in and .
case 2:
If in
because: also in
Digital signature
message space, where
randomized key generation algorithm
(often randomized) signing / encryption algor. that generates a tag
verification algorithm - decrypts and if it is equal to returns
Correctness
CMA-Security
Chosen message attack CMA: access to decryption algorithm..
Goal: forging a signature - if attacker is successful in then the verifier must return .
Naive RSA-based Digital Signatures
Same as naive RSA but
with encryption being the signing algorithm just returning and der Verifier returning if the decrypted is equal to .
Correctness
in
This is a simplified version. Not secure.
Would be secure if the signing algorithm would also hash the messages: