Most of these notes are taken while reading Chapter 3 of Introduction to Modern Cryptography and you'll notice that terms, definitions and theorems are directly adapted from the source. It's advised to read the original source than these incomplete notes.
Computational Security: in contrast to Perfect Secrecy, computational security allows for small probability of leaking information and computational limits on the attacker (efficient adversaries).
A scheme is secure if an attacker can break the scheme in at most time with probability at most .
Asymptotic Approach: rather than concrete-security approach, most cryptographic protocols’ security are defined by security parameter , and running time of adversary, success probability are functions of security parameter, rather than concrete values.
- Efficient adversaries run in polynomial time
- : refers to the small success probabilities, less than inverse of .
PPT: probabilistic polynomial-time. Secure scheme: If a PPT adversary succeeds in breaking the scheme with negl probability.
Asymptotic approach
Two things to consider:
- polynomial-time algorithms: any function is polynomially bounded if for any constant , for all n. an algorithm runs in polynomial time, if for a polynomial and input , it terminates in steps.
- negligible function: a function is negligible if for every polynomial , there exists such that for every , , or from the definition of polynomial function, for all constants , there exists such that for every , .
Cryptographic algorithms are probabilistic (randomised), that’s why attackers are allowed to be probabilistic as well. This gives attackers more powers and allows to model more practical attacks.
probabilistic (randomised) algorithms are one that use randomness in their logic. Normally, randomness is used in the input.
TODO: explain some examples of negligible functions, and why some functions are preferred over other across different range of inputs.
Main importance of negligible functions is that they obey closure properties:
- is also negligible.
- is also negligible. This means that repeating an experiment that repeats a negligible event any number of times still succeeds with negligible probability.
A scheme is secure if for every PPT adversary , and such that for all , the probability of attack's success is less than .
Computationally Secure encryption
- Define encryption as and model an adversary with additional power being eavesdropping, i.e. it can look at all the messages as an observer, and the adversary is efficient as explained in previous section.
- Define an indistinguishability experiment where is a encryption scheme and is a PPT adversary, in which adversary chooses messages and receives encryption and has to output a bit . According to the definition, is computationally secure if .
- Define Semantic Security as a slightly weaker notation of Perfect secrecy. Now, define that the notion of indistinguishability is similar to semantic security by two reductions:
- probability of adversary determining the th bit of message from is less than , i.e. it’s same as adversary randomly guessing the bit.
- probability of adversary determining the function on , regardless of its distribution , from is equal to adversary computing without knowledge of ciphertext.
- Define Semantic security as probability of determining from and external knowledge , where is sampled from PPT algorithm , equal to probability of adversary computing from .
- Now, any encryption is EAV-secure iff it is semantically secure in presence of eavesdropper.
Semantically secure encryption
-
having defined semantic security, we’re now interested in realising a encryption scheme
-
for that we need randomisation and true random generators are difficult to model computationally, that’s why in cryptography pseudorandom numbers are used.
-
to construct an EAV-secure encryption scheme using PRG, we need help of reduction proofs.
-
Reduction Proofs: To prove that problem X is hard, we reduce the notion of security in problem X to already hard problem X’, and prove that if X is solved, this means X’ is solved, this leads to contradiction.
- Model adversary A for X which simulates attack for adversary A’ on X’ which A’ succeed with probability , and outputs directly related to the output of X’ with probability .
- Now, if isn’t negligible, neither is , this means, A’ can break X’ if A breaks X. but according to our assumption is negligible.
-
encryption scheme using prg uses keystream as pad generated by PRG and encryption is done using XOR cipher. This is unconditionally secure if is truly random by one-time pads (OTP).
-
To prove it’s EAV-secure, we reduce the problem by introducing a distinguisher that simulates attack for adversary on encryption scheme .
-
D only succeeds when succeeds,
-
using one time pad, we identify that if encryption is done on a uniform string using one time pad, probability is exactly equal to 1/2
-
since, G is a PRG, there is a negligible probability of success in distinguishing pseudorandom string to uniform string, this equates to encryption directly, and thus, it also has slightly higher probability than 1/2.
-
define multiple encryption scheme, i.e. eavesdropper shouldn’t be able to distinguish even when same message is encrypted by the scheme.
Chosen plaintext attacks
- multiple encryption indistinguishability refers to probability of adversary to differ between two sets of ciphertexts generated using list of messages chosen by .
- It’s not possible to have multiple encryption indistinguishability if encryption is stateless and deterministic.
- Chosen Plaintext Attack (CPA) security: only difference with EAV-security is key is derived before adversary chooses messages, and adversary has access to encryption oracle.
- Encryption oracle can be used by adversary to get ciphertext for any message, and the adversary can interact with oracle as many times as it likes.
- CPA indistinguishability experiment :
- key is chosen by running
- is given oracle access to chooses messages
- uniform bit is chosen and is given to
- adversary outputs bit , and succeeds if .
- CPA security: prob. of success is
- CPA security for multiple encryption: oracle access is given to , which on input two messages sends encryption of where b is uniform bit chosen at the beginning of experiment
- CPA-secure for multiple encryptions if .
- CPA security for multiple encryption means CPA security for single Encryption
- In fact, encryption that are CPA secure are also CPA secure for multiple encryption. Prove this.
- Above is not true for EAV-security, i.e. encryption that are EAV-secure might not be EAV-secure for multiple encryption. Perfect example is one-time pads.
CPA security from PRF
- A CPA-secure encryption function can be formed using any PRF by just XORing the input message with output of PRF where seed for PRF is chosen uniformly. and is padded with encrypted output to form ciphertext, i.e. , and decrypted by again XORing
- To prove this scheme is CPA secure, we need to prove that
- Common template used throughout proving encryption schemes secure, is to first consider hypothetical true-random variant of the scheme and prove using reduction proofs that adversary doesn’t gain any advantage, and then add pseudorandomness to do probabilistic analysis.
- prove in two steps: first define a distinguisher that will simulate CPA for adversary , and use it’s output to determine whether encryption oracle is pseudorandom, i.e. or chosen uniformly from .
- i.e. Prove
- Let’s explain how works. has access to encryption oracle .
- Setup . queries for message . Choose a uniform and obtain .
- chooses challenge messages . choose uniform bit and queries , returns the ciphertext to .
- continue asking encryption oracle queries until it outputs bit
- There can be two scenarios:
- When function is pseudorandom, view as a subroutine in is identical to CPA experiment of a PRF. Thus,
- When function is random function , then view is identical to CPA experiment of random function. Thus,
- Thus, by assumption that is Pseudorandom, we establish that .
- Next step is to prove that .
- Left as exercise for future me.
Ciphers and Mode of Operation
Encrypt arbitrary long messages using symmetric encryption primitives. Two of them are:
- Stream Ciphers
- Block Ciphers
Stream Ciphers
- Instantiation of PRNGs using stream ciphers.
- Deterministic algorithms:
- support arbitrary length messages using
- a stream cipher without an IV is a PRG.
- stream cipher with an PRG is a PRF, such that
- converse can be also true, i.e. creating stream ciphers using PRF, by concatenating with counters.
- Modes of Operation:
- Synchronised mode: stateful mode, doesn’t need an IV
- Unsynchronised mode: stateless mode
CCA security
Chosen-Ciphertext attack where the adversary makes the receiver decrypt a ciphertext of its own choice and in turn learns something original message m or key k. This is what is meant by secrecy in cryptographic land.
CPA security and Message authentication deal with message integrity where attacker isn’t able to modify the ciphertext, and if it does, receiver will accept with only negligible probability.
Let’s understand some attacks possible when adversary has access to decrypt a ciphertext of it’s choice, and learns something about the original message, sometimes the complete message.
- Padding oracle attack: most of block cipher mode of operation use padding to turn plaintext into multiple of cipher’s block size. Most common padding used is PKCS#7 which appends a byte equal to number of bytes required to turn plaintext into a multiple, that number of times. CBC mode is prone to padding oracle attack, where attacker can learn complete message.
- CAPTCHA: user can learn captcha’s original image by using captcha server as oracle.
CCA indistinguishability experiment :
- Key is generated by
- has access to encryption and decryption oracle .
- outputs pair of messages
- uniform bit is chosen and challenge ciphertext is computed and given to
- continues to submit encryption and decryption queries to the oracle, but can’t submit queries to chosen messages, i.e. .
- outputs bit
- experiment outputs 1 if , else 0
As demonstrated in Padding oracle attack, that any encryption scheme that satisfies CCA security has to be non-malleable, i.e. any change in the ciphertext shouldn’t directly correspond to change in the plaintext as this allows attacker to gain insights about original message.