@@ -75,7 +75,7 @@ well-studied mathematical problem such as factoring large numbers.
7575Even then there may be problems of implementation that will only get
7676discovered by the scrutiny of those looking at and using the
7777algorithm. And in many cases, we just have to rely on the fact that
78- no-ne has yet found a viable way to break the cipher. Fortunately,
78+ no-one has yet found a viable way to break the cipher. Fortunately,
7979there are plenty of people who will try to break ciphers and who will
8080let it be widely known when they have succeeded.
8181
@@ -364,7 +364,7 @@ above.
364364
365365 Authentication using public keys.
366366
367- Public-key cryptograpy has an interesting history. The concept of
367+ Public-key cryptography has an interesting history. The concept of
368368public-key ciphers was first published in 1976 by Diffie and
369369Hellman. Subsequently, however, documents have come to light proving
370370that Britain’s Communications-Electronics Security Group had
@@ -396,7 +396,7 @@ slower than secret-key ciphers. Consequently, secret-key ciphers are
396396used for the vast majority of encryption, while public-key ciphers are
397397reserved for use in authentication and session key establishment.
398398
399- 3.4 Message Authentication Codes
399+ 3.4 Message Authentication
400400---------------------------------
401401
402402Encryption alone does not provide data integrity. For example, just
@@ -411,57 +411,67 @@ after that participant created it.
411411An *message authentication code * is a value, to be included in a transmitted message,
412412that can be used to verify simultaneously the authenticity and the data
413413integrity of a message. We will see later how such codes can be used in
414- protocols. For now, we focus on the algorithms that produce
415- authentication codes.
414+ protocols. For now, we focus on the algorithms that can generated and verify
415+ authentication codes.
416416
417417When data is stored or transmitted, it is routine to use
418418error-detecting or error-correcting codes. These are pieces of
419419information added to a stored or transmitted data object so the
420420receiver detects when the data has been inadvertently modified by bit
421421errors. Error-correcting codes are used on CDs and DVDs, for example, to deal with
422422data corruption from scratches or dust. A similar concept applies to
423- authenticators , with the added challenge that the corruption of the
423+ authentication codes , with the added challenge that the corruption of the
424424message is likely to be deliberately performed by someone who wants
425- the corruption to go undetected. To support authentication, an
426- authenticator includes some proof that whoever created the
427- authenticator knows a secret that is known only to the alleged sender
425+ the corruption to go undetected. To support authentication, the
426+ code includes some proof that whoever created it
427+ knows a secret that is known only to the alleged sender
428428of the message; for example, the secret could be a key, and the proof
429429could be some value encrypted using the key. There is a mutual
430- dependency between the form of the redundant information and the form
431- of the proof of secret knowledge. We will discuss several workable
430+ dependency between the way the code is generated and how it is used as
431+ proof of secret knowledge. We will discuss several workable
432432combinations.
433433
434- For simplicity, let's assume initially that the original message need not be
435- confidential—that a transmitted message will consist of the plaintext of
436- the original message plus an authentication code. Later we will consider the
437- case where confidentiality is desired.
434+ For simplicity, let's assume initially that the original message need
435+ not be confidential—that a transmitted message will consist of the
436+ plaintext of the original message plus some additional code to support
437+ authentication. Later we will consider the case where confidentiality
438+ is desired.
438439
439- One kind of message authentication combines encryption and a
440+ One common build block of message authentication is a
440441*cryptographic hash function *. Cryptographic hash algorithms are
441442treated as public knowledge, as with cipher algorithms. A
442443cryptographic hash function is a function that outputs sufficient
443444information about a message to expose any tampering. Just as a
444445checksum or error-detecting code exposes bit errors introduced by
445- noisy links or scratched disks, a cryptographic checksum is designed
446- to expose deliberate corruption of messages by an adversary. The value
447- it outputs is called a *message digest * and, like an ordinary
448- checksum, is appended to the message. All the message digests produced
449- by a given hash have the same number of bits regardless of the length
450- of the original message. Since the space of possible input messages is
451- larger than the space of possible message digests, there will be
446+ noisy links or scratched disks, a cryptographic hash is designed to
447+ expose deliberate corruption of messages by an adversary. The value it
448+ outputs is called a *message digest * and, like an ordinary checksum,
449+ is appended to the message. All the message digests produced by a
450+ given hash have the same number of bits regardless of the length of
451+ the original message. Since the space of possible input messages is
452+ larger than the space of possible message digests, there will be many
452453different input messages that produce the same message digest, like
453- collisions in a hash table. An important property of hash functions is
454- that such collisions may not be produced deliberately under
455- the control of the attacker.
456-
457- A message authentication code can be created by encrypting the message digest. The
454+ collisions in a hash table. An important property of cryptographic
455+ hash functions is that such collisions may not be produced
456+ deliberately under the control of the attacker.
457+
458+ A message authentication code can be created by encrypting the message
459+ digest with some key. That key could be the private key of an
460+ asymmetric cipher, known only to the sender, or it could be a secret
461+ key for a symmetric cipher that sender and receiver agreed to by some
462+ other means. On receiving the message, the
458463receiver computes a digest of the plaintext part of the message and
459464compares that to the decrypted message digest. If they are equal, then
460465the receiver would conclude that the message is indeed from its alleged
461466sender (since it would have to have been encrypted with the right key)
462- and has not been tampered with. No adversary could get away with sending
463- a bogus message with a matching bogus digest because she would not have
464- the key to encrypt the bogus digest correctly. An adversary could,
467+ and has not been tampered with.
468+
469+ Suppose that an adversary intercepts the message on its way to the
470+ receiver and tries to modify the transmitted message in
471+ some way. The message digest for this corrupted message would (with
472+ very high likelihood) differ from that of the original message. And
473+ the adversary lacks the necessary key to
474+ encrypt the digest of the corrupted message. An adversary could,
465475however, obtain the plaintext original message and its encrypted digest
466476by eavesdropping. The adversary could then (since the hash function is
467477public knowledge) compute the digest of the original message and
@@ -480,7 +490,10 @@ matches that of a given message. If the outputs are not randomly
480490distributed—that is, if some outputs are much more likely than
481491others—then for some messages you could find another message with the
482492same digest much more easily than this, which would reduce the
483- security of the algorithm. If you were instead just trying to find any
493+ security of the algorithm. So a random distribution of hash outputs is
494+ an important property for these algorithms.
495+
496+ If you were instead just trying to find any
484497*collision *—any two messages that produce the same digest—then you
485498would need to compute the digests of only 2\ :sup: `64` messages, on
486499average. This surprising fact is the basis of the “birthday
@@ -492,14 +505,15 @@ years, including Message Digest 5 (MD5) and the Secure Hash Algorithm
492505known for some time, which led NIST to recommend a family of
493506algorithms known as SHA-3 in 2015.
494507
495- When generating an encrypted message digest, the digest encryption could use
508+ AS noted above, the encryption of the message digest can be performed using
496509either a secret-key cipher or a public-key cipher. If a public-key
497- cipher is used, the digest would be encrypted using the sender’s private
498- key (the one we normally think of as being used for decryption) , and the
510+ cipher is used, the digest is encrypted using the sender’s private
511+ key, and the
499512receiver—or anyone else—could decrypt the digest using the sender’s
500- public key.
513+ public key. If a secret-key cipher is used, the sender and receiver
514+ have to agree on the secret key ahead of time using some other means.
501515
502- A digest encrypted with a public key algorithm but using the private
516+ A digest encrypted with a public- key algorithm using the private
503517key of the sender
504518is called a *digital signature * because it provides nonrepudiation
505519similar to that of
@@ -510,32 +524,35 @@ herself. Secret-key encryption of a digest does not have this property
510524because only the two participants know the key; furthermore, since both
511525participants know the key, the alleged receiver could have created the
512526message herself. Any public-key cipher can be used for digital
513- signatures. *Digital Signature Standard * (DSS) is a digital signature
514- format that has been standardized by NIST. DSS signatures may use any
515- one of three public-key ciphers, one based on RSA, another on ElGamal,
516- and a third called the *Elliptic Curve Digital Signature Algorithm *.
517-
518- Another kind of authenticator is similar, but instead of encrypting a
519- hash it uses a hash-like function that takes a secret value (known
520- only to the sender and the receiver) as a parameter, as illustrated in
521- :numref: `Figure %s <fig-macAndHmac >`. Such a function outputs an
522- authenticator called a *message authentication code * (MAC). The sender
523- appends the MAC to her plaintext message. The receiver recomputes the
524- MAC using the plaintext and the secret value and compares that
525- recomputed MAC to the received MAC.
527+ signatures. NIST has produced a series of *Digital Signature
528+ Standards * (DSS). The most recent standard at the time of writing
529+ allows for the use of three public-key ciphers, one based on RSA,
530+ another based on elliptic curves, and
531+ and a third called the *Edwards-Curve Digital Signature Algorithm *.
532+
533+ .. should check the above for updates
534+
535+ An alternative approach to encrypting a
536+ hash is to use a hash function that takes a secret value (known
537+ only to the sender and the receiver) as an input parameter. Such a function outputs a
538+ message authentication code that is a function of both the secret key
539+ and the message contents. The sender
540+ appends the code to the plaintext message. The receiver recomputes the
541+ authentication code using the plaintext and the secret value and compares that
542+ recomputed code to the code received in the message.
526543
527544.. _fig-macAndHmac :
528- .. figure :: figures/f08-05-9780123850591 .png
529- :width: 600 px
545+ .. figure :: figures/f08-05-modified .png
546+ :width: 300 px
530547 :align: center
531548
532- Computing a MAC (a) versus computing an HMAC (b ).
549+ Computing a hashed message authentication code (HMAC ).
533550
534- A common variation on MACs is to apply a cryptographic hash (such as
535- MD5 or SHA-1 ) to the concatenation of the plaintext message and the
551+ One way to implement the approach just described is to apply a cryptographic hash (such as
552+ SHA-3 ) to the concatenation of the plaintext message and the
536553secret value, as illustrated in :numref: `Figure %s
537554<fig-macAndHmac>`. The resulting digest is called a *hashed message
538- authentication code * (HMAC) since it is essentially a MAC . The HMAC,
555+ authentication code * (HMAC). The HMAC,
539556but not the secret value, is appended to the plaintext. Only a receiver
540557who knows the secret value can compute the correct HMAC to compare
541558with the received HMAC. If it weren’t for the one-way property of the
@@ -545,18 +562,28 @@ value.
545562
546563Up to this point, we have been assuming that the message wasn’t
547564confidential, so the original message could be transmitted as plaintext.
548- To add confidentiality to a message with an authenticator , it suffices
565+ To add confidentiality to a message with an authentication code , it suffices
549566to encrypt the concatenation of the entire message including its
550- authenticator—the MAC, HMAC, or encrypted digest . Remember that, in
567+ authentication code . Remember that, in
551568practice, confidentiality is implemented using secret-key ciphers
552569because they are so much faster than public-key ciphers. Furthermore, it
553570costs little to include the authenticator in the encryption, and it
554- increases security. A common simplification is to encrypt the message
555- with its (raw) digest, such that the digest is only encrypted once; in
556- this case, the entire ciphertext message is considered to be an
557- authenticator.
558-
559- Although authenticators may seem to solve the authentication problem, we
560- will see in a later chapter that they are only the foundation of a
561- solution. First, however, we address the issue of how participants
571+ increases security.
572+
573+ In recent years, the idea of using a single algorithm to support both
574+ authentication and encryption has gained support for reasons of
575+ performance and simplicity of implementation. This is referred to as
576+ *authenticated encryption * or *authenticated encryption with
577+ associated data *. The latter term allows for some data fields
578+ (e.g., packet headers) to be transmitted as plaintext—these are the
579+ associated data—while the rest
580+ of the message is encrypted, and the whole thing, headers included, is
581+ authenticated. We won't go into details here, but there is now a set of
582+ integrated algorithms that produce both ciphertext and authentication
583+ codes using a combination of ciphers and hash functions.
584+
585+
586+ Now that we have seen some of the building blocks for encryption and
587+ authentication, we have the foundations for building some complete security
588+ solutions. Before we get to those, however, we address the issue of how participants
562589obtain keys in the first place.
0 commit comments