Cryptography concepts

Class notes! Wahoo

Polynomial function

For complexity theory’s sake, we say a function f(n)f(n) is polynomial if there exists a value cc such that f(n)<ncf(n) < n^c.

The notation poly(n)poly(n) or P(n)P(n) represents some unspecified polynomial function of n.

It’s closed under multiplication.

Negligible function

“a function which approaches 0 faster than the reciprocal of every polynomial”

With big-o notation we’d say a function f(n)f(n) is negligible if f(n)O(1poly(n))f(n) \in O(\frac{1}{poly(n)}) for any arbitrary polynomial function.

For example 12n\frac{1}{2^n} is negligible. This specific negligible function comes up a lot because it represents the probability of an adversary guessing a secret nn-bit key.

The notation ϵ(n)\epsilon(n) represents some unspecified negligible function of n.

Important properties:

Indistinguishability experiment

Given in the slides with some weird PrivKπ,AeavPrivK^{eav}_{\pi, A} notation, where AA is the attacker and π\pi is the encryption scheme under test.

There are two parties in an indistinguishability experiment, the attacker A and the encryptor B.

The experiment is a success (as in, the funny PrivKPrivK function returns 1) if A guesses correctly, and a failure if A guesses incorrectly. Usually there is a constraint that m1m_1 and m2m_2 are the same length so that A can’t simply make a guess informed by the length of the ciphertexts. Or just having A not make such a guess in its algorithm.

And we typically talk about the probability of an indistinguishability experiment succeeding.

Perfect secrecy and indistinguishability

In a perfectly secret system, seeing ciphertext gives absolutely no information about the message it encrypts. The notation in the slides is Pr[M=m|C=c]=Pr[M=m]Pr[M=m | C=c] = Pr[M=m] and I think how you interpret this (from the perspective of like, an eavesdropper or attacker):

In a perfectly indistinguishable system, Pr[PrivKπ,Aeav=1]12Pr[PrivK^{eav}_{\pi, A} = 1] \leq \frac{1}{2}. Or in English, the probability that an indistinguishability experiment succeeds is no better than chance.

These are two views into the same idea. All perfectly secret schemes are perfectly indistinguishable. Supposedly there’s a proof in the book. Maybe I should actually look at the book!

Perfectly secret schemes:

Key-guessing and perfect secrecy

Ok I’m going to now overlook the idea of “false-positive” keys and silliness like using a shift cipher to encrypt 1 letter.

I’m pretty sure any encryption scheme with a finitely-sized keyspace cannot be perfectly secret. A can use this algorithm:

The probability A guesses correctly is something like 12+Pr[A guessed the key correctly]\frac{1}{2} + Pr[\text{A guessed the key correctly}] and that’s not 12\leq \frac{1}{2}.

Brute-forcing and perfect secrecy

There’s also this, for finitely sized keyspaces:

Again this is kind of silly becase if there are 2a lot2^{\text{a lot}} keys this algorithm will loop up to 2a lot2^\text{a lot} times. But it will always succeed and give the right answer with probability 1 (again discounting the idea of “false-positive” keys)

Computational secrecy

We introduce a security parameter, nn, the key length. (The slides say “for now think of this as the key length”. Hmm.) Then we make two tweaks:

Complexity theory AND probability theory together, ooh.

The idea is to formalize the notion of “silly impracitcal algorithms” and eliminate them from consideration. Guessing the key has probability 12n\frac{1}{2^n}, which is a negligible function of nn. Bruteforcing the keys takes O(2n)O(2^n) time which is not in poly(n)poly(n).

Later in the class we’ve seen interactive algorithms where A can repeatedly use B as an encryption oracle; the poly(n)poly(n) limit also places an upper bound on the amount of times A can interact with B.

In real life, to use a computationally secret scheme we just raise the key length until realistic polynomials of nn are still beaten out by 2n2^n, then we’re secret enough for the real world. Even if the attacker can bruteforce 99999999999n9999999999999999999n^{99999999} keys per zeptosecond that’ll still get beaten out by 2n2^n for a long enough key. We know that the best algorithm the attacker can use is just guessing.