













Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!














Lecture 7
Michael J. Fischer
Department of Computer Science Yale University
February 1, 2010
(^1) Message authentication codes
(^2) Asymmetric Cryptosystems
A block cipher such as DES can be used to compute a MAC by making use of one of the ciphertext chaining modes CBC or CFB. In these modes, the last ciphertext block ct depends on all t message blocks m 1 ,... , mt , so, we define Ck (m) = ct. The function so computed is reputed to be a good MAC. Note that the MAC is only a single block long. This is in general much shorter than the message. A MAC acts like a checksum for preserving data integrity, but it has the advantage that an adversary cannot compute a valid MAC for an altered message.
Sending an unencrypted authenticated message. Alice sends m in the clear along with the MAC ξ = Ck (m). Bob receives m′^ and ξ′, possibly different from m and ξ. Bob checks that ξ′^ = Ck (m′) and if so, accepts m′^ as a valid message from Alice. Mallory successfully cheats if Bob accepts a message m′^ as valid that Alice never sent. The assumed property of a MAC is that Mallory cannot do this, even knowing a set of valid MAC pairs previously sent by Alice. The MAC prevents forgery of messages but does not protect privacy.
Another possibility is for Alice to send c = Ek (m) and ξ = Ck (m). Here, the MAC is computed from m, not c. Bob, upon receiving c′^ and ξ′, first decrypts c′^ to get m′^ and then checks that ξ′^ = Ck (m′), i.e., Bob checks ξ′^ = Ck (Dk (c′)) In practice, this might also work, but its security does not follow from the assumed security property of the MAC. The MAC property says Mallory cannot produce a pair (m′, ξ′) for an m′^ that Alice never sent. It does not follow that he cannot produce a pair (c′, ξ′) that Bob will accept as valid, even though c′ is not the encryption of one of Alice’s messages. If Mallory succeeds in convincing Bob to accept (c′, ξ′), then Bob will decrypt c′^ to get m′^ = Dk (c′) and incorrectly accept m′^ as coming from Alice.
Here’s how Mallory might find (c′, ξ′) such that ξ′^ = Ck (Dk (c′)). Suppose the MAC function Ck and encryption function Ek are the same. Then Ck (Dk (c′)) = Ek (Dk (c′)) = c′, so Bob accepts every pair (c′, c′) as valid!^1 A more plausible example is where Ck is derived from Ek using the CBC or CFB chaining modes as described earlier. In that case, the MAC is the last ciphertext block c t′ , and Bob will always accept (c′, c t′ ) as valid.
(^1) The astute reader will notice that Ek (Dk (c)) might differ from c for c not in the range of Ek. However, in most of the cryptosystems we consider, the message space M and ciphertext space C are the same. When that is the case, the range of Ek is all of C, so every c ∈ C can be written as c = Ek (y ) for some message y , and Ek (Dk (c)) = Ek (Dk (Ek (y ))) = Ek (y ) = c.
Should be hard for Eve to find m given c = Ee (m) and e. The system remains secure even if the encryption key e is made public! Asymmetric cryptosystems are sometimes called 2-key or public key cryptosystems. ke is the public key and kd the private key. Reason to make e public. Anybody can send a private message to Bob. Sandra obtains Bob’s public key e and sends c = Ee (m) to Bob. Bob recovers m by computing Dd (c), using his private key d. This greatly simplifies key management. No longer need a secure channel between Alice and Bob for the initial key distribution (which I have carefully avoided talking about so far).
An active adversary Mallory can carry out a nasty man-in-the-middle attack. Mallory sends his own encryption key to Sandra when she attempts to obtain Bob’s key. Not knowing she has been duped, Sandra encrypts her private data using Mallory’s public key, so Mallory can read it (but not Bob)! To keep from being discovered, Mallory intercepts each message from Sandra to Bob, decrypts using his own decryption key, re-encrypts using Bob’s public encryption key, and sends it on to Bob. Bob, receiving a validly encrypted message, is none the wiser.
Good asymmetric cryptosystems are much harder to design than good symmetric cryptosystems. All known asymmetric systems are orders of magnitude slower than corresponding symmetric systems.
Asymmetric cryptosystems are often used in conjunction with a symmetric cipher to form a hybrid system. Let (E 2 , D^2 ) be a 2-key cryptosystem and (E 1 , D^1 ) be a 1-key cryptosystem. Here’s how Alice sends a secret message m to Bob. Alice generates a random session key k for use with the 1-key system. Alice computes c 1 = E (^) k^1 (m) and c 2 = E (^) e^2 (k), where e is Bob’s public key, and sends (c 1 , c 2 ) to Bob. Bob computes k = D d^2 (c 2 ) using his private decryption key d and then computes m = D k^1 (c 1 ). This is much more efficient than simply sending E (^) e^2 (m) when m is much longer than k. Note that the 2-key system is used to encrypt random messages!
The message space, ciphertext space, and key space for RSA is the set of integers between 0 and n − 1 for some very large integer n. For now, think of n as a number so large that its binary representation is 1024 bits long.
To use RSA as a block cipher to send bit strings, Alice must convert each block to an integer m, and Bob must convert m back to a block. Many such encodings are possible, but perhaps the simplest is to prepend a “1” to the block x and regard the result as a binary integer m. To decode m to a block, write out m in binary and then delete the initial “1” bit. To ensure that m < n as required, we limit the length of our blocks to 1022 bits.
To encrypt, Alice computes c = me^ mod n. 2 To decrypt, Bob computes m = cd^ mod n. This works because, for all m, we have
m = (me^ mod n)d^ mod n. (1)
Here, a mod n denotes the remainder when a is divided by n. That’s all there is to it, once the keys have been found. Most of the complexity in implementing RSA has to do with key generation, which fortunately is done only infrequently.
(^2) In the remainder of this discussion, messages and ciphertexts will refer to integers in the range 0 to n − 1, not to bit strings.
You should already be asking yourself the following questions: How does one find n, e, d such that equation 1 is satisfied? Why is RSA believed to be secure? How can one implement RSA on a computer when most computers only support arithmetic on 32-bit or 64-bit integers, and how long does it take? How can one possibly compute me^ mod n for 1024 bit numbers. me^ , before taking the remainder, has size roughly ( 21024
1024 = 2^2 (^10) × 21024 = 2^2 1034 .
This is a number that is roughly 2^1034 bits long! No computer has enough memory to store that number, and no computer is fast enough to compute it.