07.07.2023 Views

Implementing-cryptography-using-python

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

50 Chapter 2 ■ Cryptographic Protocols and Perfect Secrecy

■■

Known-Plaintext (KPA) is used when the malicious user has access to

both the plaintext and its encrypted version (ciphertext). Historical ciphers

were very susceptible to this type of attack.

■■

Chosen-Plaintext (CPA) is an attack that occurs when the malicious users

are able to define their own plaintext and have it encrypted, resulting in

ciphertext that can be analyzed to determine how to decrypt other messages.

A good example is the attacks on the German Enigma machine;

once the Allies captured an Enigma machine, the CPA was used to determine

how the encryption scheme worked.

■■

Chosen-Ciphertext (CCA) is an attack used where the cryptanalyst can

gather information by obtaining the decryptions of chosen ciphertexts.

One way to think about this type of attack is that you can test a slightly

adjusted encryption. Change a bit and see if the decrypted message turns

to gibberish. For instance, if you are a server on the internet and you

change an encrypted packet in some way, you can see how the target

reacts to your change when they go to decrypt.

Shannon’s Theorem

Claude Shannon (1916–2001) was often regarded as the father of modern cryptology

and information theory. After receiving his Ph.D. in mathematics, Shannon

contributed to the field of cryptanalysis for national defense during World War

II. He is also credited for the founding of digital circuit design theory in 1937.

He published a paper in 1949 entitled “Communication Theory and Secrecy

Systems.” In this revolutionary paper, Shannon defines perfect secrecy for

secret-key systems and shows that they exist. A secret-key cipher obtains perfect

secrecy if for all plaintexts x and all ciphertexts y, it holds that Pr(x) = Pr(x|y). In

other words, a ciphertext y gives no information about the plaintext. Shannon’s

principle states, “The enemy knows the system.”

Known as the gold standard of security in cryptography, “perfect security”

is a special case of information-theoretic security wherein for an encryption

algorithm, if there is ciphertext produced that uses it, no information about the

message is provided without knowledge of the key. Examine the definition of

perfect security as defined by Shannon.

Let ε = (E,D) be a Shannon cipher defined over (K,M,C). Consider a probabilistic

experiment in which the random variable k is uniformly distributed over

K. If for all m 0 , m 1 ∈ M, and all c ∈ C, we have: Pr[E(k, m 0 ) = c] = Pr[E(k, m 1 ) = c];

then we say that ε is a perfectly secure Shannon cipher.

To explain the definition in words, if the probability that a ciphertext c is m 0 is

the same as the probability that the same ciphertext c is m 1 , then the cipher ε is

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!