This encryption(加密) problem is starting form the transmission question: two people need to transmit information while avoiding others to know the content.
The resolution is to maintain a ‘key’ k by two people and one can use k to encrypt information while the other can use it to decrypt
Validity
A pair of polynomial-time computable functions (Enc,Dec) is a valid private key encryption scheme if for every n∈N, k∈{0,1}n,and x, we have
Dec(k,Enc(k,x))=x
And we have the length of the ciphertext(密文) is no less than that of the plaintext, written as:
lc(n)≥lp(n)
Security
We need to define the security with following assumption:
A cryptosystem should be secure even if everything about the system, except the key, is public knowledge.
Due to this assumption, the k must be generated randomly.
So, let’s define the security:
A valid encryption scheme (Enc,Dec) with plaintext length l(⋅) is perfectly secret if for every n∈N and plaintexts x0,x1∈{0,1}l(n), the following two distributions Y0and Y1 over {0,1}∗ are identical: Yi is obtained by sampling k and outputting Enc(k,xi) for i=0,1.
Definition Analysis
We have a secrecy experiment as follows:
Sample k∈{0,1}n
Adversary A outputs x0,x1 given input 1n
Randomly choose b and send y=Enc(k,xb) to A
A returns b′∈{0,1}
If b=b′, A wins
We can prove A has at most 21 probability to succeed under perfectly secret.
This means Y is independent to b, so A cannot improve its probability to win by getting y
Construction
Give the One-time pad construction:
lp(n)=lcEnc(k,x)Dec(k,c)(n)=n=x⊕k=k⊕c
In this construction, we have one glaring dis advantage, that is the k has the same length of plaintext!
This is necessary for perfect secrecy:
For every perfectly secret encryption scheme, the length function lp(n) satisfies lp(n)≤n
Computational Secrecy and PRG
The long k is unadorable in reality. So we use computational secrecy instead.
An encryption scheme is computationally secret if no probabilistic polynomial-time(PPT) algorithms can break it.
Let Enc,Dec be a valid encryption scheme. The scheme is computationally secret if, for every PPT adversary algorithm A in the secrecy experiment, there is negligible function negl such that
P(A succ)≤21+negl(n)
where the probability is taken over the randomness of A and the experiment.
Pseudorandom Generators
Definition:
A cryptographic pseudorandom generator (PRG) with stretch l(⋅) is a PPT computable function G:{0,1}∗→{0,1}∗ such that:
∀n∈N and s∈{0,1}n, ∣G(s)∣=l(n)
For any poly-algorithm A, s∈{0,1}n and r∈{0,1}l(n):
∣P(A((G(s)))=1)−P(A((r))=1)∣=negl(n)
Intuitively, this means we can get the difference between output of PRG G(⋅) and a actual random output r in a negligible probability.
Its existance is obtained by the cryptographic PRG conjecture: PRG with l(n)=na∀a∈N exists.
If the cryptographic PRG conjecture is true, then computationally secret encryption exists for l(n)≥na∀a∈N
Enc(k,x)Dec(c,k)=x⊕G(k)=c⊕G(k)
This can be proved to be computation secret by contradiction proof, which is to construct a adversary for PRG by the assuming contradiction.
CPA Security and PRF
Choose Plaintext Attack (CPA)
The CPA experiments is similar to secrecy experiments, while A can interact freely with Enc(k,⋅) as a black-box.
An encryption scheme (Enc,Dec) is CPA-secure if, for all PPT adversary A, there exists a negligible function negl such that
P(A succ)≤21+negl(n)
All CPA-secure encryption scheme must be probabilistic otherwise A can query all Enc(k,x) to get ciphertexts and compare.
Pseudorandom Functions (PRF)
Consider a keyed family of functions: Fk:{0,1}∗→{0,1}∗, then we can define PRF as follows:
Let Fk be a keyed family of functions that is efficient and length-preserving. We say Fk is a pseudorandom function if, for all PPT distinguishers D, there exists a negligible function negl such that:
∣P(DFk(⋅)(1n)=1)−P(Dfn(⋅)(1n)=1)∣≤negl(n)
where k←{0,1}n is chosen uniformly at random and fn is chosen uniformly from the set of functions mapping n-bit strings to n-bit strings.
Intuitively, this means we can get the difference between PRF Fk(⋅) and a actual random funtions f in a negligible probability.
PRF => CPA-secure Encryption
Let F be a PRF. Define a CPA-secuee private-key encryption scheme for messages of length n as follows:
Enc(k,x)=⟨r,Fk(r)⊕x⟩
Dec(k,⟨r,s⟩)=Fk(r)⊕s
In this r←{0,1}n is randomly chosen.
Proof is as follows, we use contradiction-proof and construct a contradiction to PRF with assumption.
Consider above scheme as Π=(Enc,Dec) and the similar scheme Π=(Enc,Dec) in which we replace Fk with an actual random function.
Assume that Π is not CPA-secure, which means there exists an A:
P(AΠ succ)≥21+poly(n)1
Let rc represents the randomness used in encrypting x, while r1,…,rq represents the q(n)=poly(n) randomness used when A queries to the oracle Enc. Then we can argue that:
P(AΠ succ)≤21+negl(n)
We can argue this according to whether rc∈{r1,…,rq}
If rc∈{r1,…,rq}, then A can actually get rc as we contain it in the ciphertext. So A can always succeed in this case.But this case has a negligible probability 2nq(n) to appear.
If rc∈/{r1,…,rq}, then the encryption is like a perfect OTP as we cannot get any information about the random function f. So A has a probability of 21 to win.