CSS411 Cryptography

Key Management Notes

Supplementary notes on public-key distribution, X.509 certificates and public-key distribution of secret keys.

19 min read

OverviewSearch on YouTube

Two aspectsSearch on YouTube

The notes give two distinct aspects of the use of public-key encryption for key management:

AspectQuestion
Distribution of public keysHow does AA get an authentic copy of the public key of BB?
Use of public-key encryption to distribute secret keysHow do AA and BB get a session key for conventional encryption?

Four schemesSearch on YouTube

Virtually all proposals for the distribution of public keys fit into four general schemes:

SchemeTrusted partyWeakness
A) Public announcementNoneAnyone can forge an announcement
B) Publicly available directoryA trusted entity keeps the directoryCompromise of the private key of the authority, or tampering with its records
C) Public-key authorityA central authority, with a public key that all participants knowThe authority is a bottleneck, and the directory is vulnerable to tampering
D) Public-key certificatesA certificate authority (CA)Participants must trust the CA

Distribution of public keysSearch on YouTube

Public announcementSearch on YouTube

The public key is public. Thus, with a broadly accepted algorithm such as RSA, any participant can send its public key to another participant. It can also broadcast the key to the community at large (Figure 1, "Uncontrolled Public Key").

The approach is convenient, but it has a major weakness. Anyone can forge such a public announcement.

Publicly available directorySearch on YouTube

A publicly available, dynamic directory of public keys gives more security. A trusted entity or organisation must maintain and distribute the directory (Figure 2). The scheme has these elements:

  • The authority keeps a directory with a {name,public key}\{name, public\ key\} entry for each participant.
  • Each participant registers a public key with the directory authority. The registration is in person or by secure authenticated communication.
  • A participant can replace its key with a new key at any time. One reason is that the key was used for a large amount of data. Another reason is that the private key was compromised.
  • Periodically, the authority publishes the full directory or updates to it. For example, it can publish a hard-copy book like a telephone book, or list updates in a newspaper.
  • Participants can also access the directory electronically. This needs secure, authenticated communication from the authority to the participant.

This scheme is more secure than individual announcements, but it still has vulnerabilities:

  • An opponent can get or compute the private key of the directory authority. Then the opponent can give out counterfeit public keys, impersonate any participant and eavesdrop on messages to any participant.
  • An opponent can also tamper with the records that the authority keeps.

Public-key authoritySearch on YouTube

A public-key authority gives stronger security with tighter control over the distribution of public keys from the directory.

  • A central authority keeps a dynamic directory of the public keys of all participants.
  • Each participant reliably knows a public key of the authority. Only the authority knows the matching private key.

This scheme is not perfect. The authority can be a bottleneck, because a user must ask it for the public key of each user that it wants to contact. Also, the directory of names and public keys is vulnerable to tampering.

Public-key certificatesSearch on YouTube

With certificates, participants exchange keys without contact with a public-key authority.

  • A certificate authority creates each certificate. The certificate contains a public key and other information.
  • The CA gives the certificate to the participant that has the matching private key.
  • A participant sends its key information to another participant in its certificate.
  • Other participants can verify that the authority created the certificate.

The scheme has four requirements:

  1. Any participant can read a certificate to find the name and public key of the owner.
  2. Any participant can verify that the certificate comes from the CA and is not counterfeit.
  3. Only the CA can create and update certificates.
  4. Any participant can verify the currency of the certificate.

CA=EKRauth[T,IDA,KUA]C_A = E_{KR_{auth}}[T, ID_A, KU_A]

CAC_A is the certificate of AA, and KRauthKR_{auth} is the private key of the CA. TT is a timestamp, IDAID_A is the identifier of AA, and KUAKU_A is the public key of AA. Any participant verifies it with the public key of the CA:

DKUauth[CA]=DKUauth[EKRauth[T,IDA,KUA]]=(T,IDA,KUA)D_{KU_{auth}}[C_A] = D_{KU_{auth}}[E_{KR_{auth}}[T, ID_A, KU_A]] = (T, ID_A, KU_A)

The PDF writes the inner term as EKUauthE_{KU_{auth}}. This is a typing error. The CA encrypts with its private key KRauthKR_{auth}, so DKUauthD_{KU_{auth}} can recover the contents.

X.509 authentication serviceSearch on YouTube

Purpose and historySearch on YouTube

  • The ITU-T recommendation X.509 is part of the X.500 series of recommendations. X.500 defines a directory service.
  • X.509 defines a framework for authentication services by the X.500 directory to its users.
  • The directory can be a repository of public-key certificates.
  • Each certificate contains the public key of a user. The private key of a trusted CA signs it.
  • X.509 uses public-key cryptography and digital signatures, for example RSA and hash functions such as MD5.
VersionYear
First issue1988
Revised recommendation, for security concerns1993
Third version1995, revised in 2000

User certificates from a CA have these characteristics:

  • Any user with the public key of the CA can recover the certified public key of the user.
  • No party other than the CA can modify the certificate. Thus certificates can be kept in the directory without special protection.

Certificate fieldsSearch on YouTube

Figure 3 shows the X.509 certificate format:

FieldContent
VersionIdentifies the certificate format. The default is version 1. If an issuer or subject unique identifier is present, it must be version 2. If one or more extensions are present, it must be version 3.
Serial numberAn integer, unique within the issuing CA, for this certificate
Signature (algorithm identifier)The algorithm used to sign the certificate, with its parameters. It has little use, because the final signature field repeats this information.
Issuer nameX.500 name of the CA that created and signed the certificate
Period of validityTwo dates: the first and the last date on which the certificate is valid
Subject nameName of the user to whom the certificate refers
Subject's public-key informationThe public key of the subject, the algorithm identifier and its parameters
Issuer unique identifierOptional bit string. It identifies the CA if its X.500 name was reused for different entities.
Subject unique identifierOptional bit string. It identifies the subject if its X.500 name was reused for different entities.
ExtensionsOne or more extension fields, added in version 3
SignatureCovers all other fields. It is the hash code of the other fields, encrypted with the private key of the CA, with the signature algorithm identifier.

Version 1 fields end at the subject public-key information. Version 2 adds the two unique identifiers. Version 3 adds extensions. The signature is in all versions.

Distribution of secret keysSearch on YouTube

Why use public keysSearch on YouTube

After public keys are distributed, secure communication against eavesdropping and tampering is possible. But few users want to use only public-key encryption, because its data rates are relatively slow. Thus, public-key encryption is a vehicle to distribute secret keys for conventional encryption.

Merkle's simple schemeSearch on YouTube

Ralph Merkle put forward an extremely simple scheme (Figure 4). If AA wants to communicate with BB:

  1. AA generates a key pair {KUA,KRA}\{KU_A, KR_A\}. AA sends KUAKU_A and its identifier IDAID_A to BB.
  2. BB generates a secret key KsK_s and sends it to AA, encrypted with KUAKU_A.
  3. AA computes DKRA[EKUA[Ks]]D_{KR_A}[E_{KU_A}[K_s]] to recover KsK_s. Only AA can decrypt the message, so only AA and BB know KsK_s.
  4. AA discards KUAKU_A and KRAKR_A. BB discards KUAKU_A.

AA and BB then communicate securely with KsK_s. At the end of the exchange, both discard KsK_s.

No keys exist before the communication starts, and none exist after it ends. Thus the risk of key compromise is minimal, and the communication is secure from eavesdropping.

Active attackSearch on YouTube

The protocol is vulnerable to an active attack. An opponent EE who controls the channel can do this without detection:

  1. AA generates {KUA,KRA}\{KU_A, KR_A\} and sends KUAKU_A and IDAID_A to BB.
  2. EE intercepts the message. EE makes its own key pair {KUE,KRE}\{KU_E, KR_E\} and sends KUE∥IDAKU_E \Vert ID_A to BB.
  3. BB generates KsK_s and sends EKUE[Ks]E_{KU_E}[K_s].
  4. EE intercepts the message and gets KsK_s with DKRE[EKUE[Ks]]D_{KR_E}[E_{KU_E}[K_s]].
  5. EE sends EKUA[Ks]E_{KU_A}[K_s] to AA.

AA and BB both know KsK_s, but they do not know that EE also knows it. EE then only eavesdrops and decrypts all messages.

The simple protocol is useful only when the only threat is eavesdropping.

Confidentiality and authenticationSearch on YouTube

The scheme in Figure 5 protects against active and passive attacks. It assumes that AA and BB already exchanged public keys with one of the four schemes.

  1. A→BA \to B: EKUb[N1∥IDA]E_{KU_b}[N_1 \Vert ID_A]. The nonce N1N_1 identifies this transaction.
  2. B→AB \to A: EKUa[N1∥N2]E_{KU_a}[N_1 \Vert N_2]. Only BB could decrypt message 1. Thus N1N_1 in message 2 tells AA that the correspondent is BB.
  3. A→BA \to B: EKUb[N2]E_{KU_b}[N_2]. This tells BB that the correspondent is AA.
  4. AA selects a secret key KsK_s and sends M=EKUb[EKRa[Ks]]M = E_{KU_b}[E_{KR_a}[K_s]] to BB.
  5. BB computes DKUa[DKRb[M]]D_{KU_a}[D_{KR_b}[M]] to recover KsK_s.

In message 4, the encryption with KUbKU_b makes sure that only BB can read the message. The encryption with KRaKR_a makes sure that only AA could send it. Thus the scheme gives confidentiality and authentication.

Hybrid schemeSearch on YouTube

IBM mainframes use a hybrid approach:

  • A key distribution centre (KDC) shares a secret master key with each user.
  • The KDC distributes secret session keys encrypted with the master key.
  • A public-key scheme distributes the master keys.

The notes give this rationale for the three-level approach:

ReasonExplanation
PerformanceIn many applications, especially transaction-oriented ones, the session keys change frequently. Public-key distribution of each session key can decrease system performance. With three levels, public-key encryption only occasionally updates the master key between a user and the KDC.
Backward compatibilityThe hybrid scheme is easily put on top of an existing KDC scheme, with minimal disruption or software changes.

The public-key layer gives a secure, efficient means to distribute master keys. This is an advantage when one KDC serves a widely distributed set of users.

Quick self-testSearch on YouTube

Give the four schemes for public-key distribution and one weakness of each.

Public announcement: anyone can forge it. Publicly available directory: an opponent can get the private key of the authority or tamper with its records. Public-key authority: it is a bottleneck, and its directory is vulnerable to tampering. Certificates: participants must trust the CA.

Why is a public announcement of keys not reliable?

An announcement has no proof of identity. Anyone can announce a key with the name of another participant.

Give the four requirements of a certificate scheme.

Any participant can read a certificate. Any participant can verify that it comes from the CA and is not counterfeit. Only the CA can create and update certificates. Any participant can verify the currency of the certificate.

Write the certificate of A and how a participant verifies it.

CA=EKRauth[T,IDA,KUA]C_A = E_{KR_{auth}}[T, ID_A, KU_A]. A participant computes DKUauth[CA]=(T,IDA,KUA)D_{KU_{auth}}[C_A] = (T, ID_A, KU_A).

When must the X.509 version field be 2 or 3?

Version 2 when an issuer or subject unique identifier is present. Version 3 when one or more extensions are present.

Give the Merkle scheme and its weakness.

AA sends KUAKU_A and IDAID_A. BB returns EKUA[Ks]E_{KU_A}[K_s]. AA decrypts with KRAKR_A, then both discard the temporary keys. An active opponent replaces KUAKU_A with KUEKU_E and learns KsK_s without detection.

In the scheme with confidentiality and authentication, how does A know that the correspondent is B?

Message 1 is encrypted with KUbKU_b, so only BB can read N1N_1. When N1N_1 comes back in message 2, AA knows that BB sent it.

Why does the hybrid scheme use public-key encryption only for master keys?

Session keys change frequently, and public-key encryption has a high computational load. The master key changes only occasionally. The scheme also fits on top of an existing KDC.

  • Public keys are distributed by announcement, directory, authority or certificates. Each scheme removes a weakness of the scheme before it.
  • A certificate CA=EKRauth[T,IDA,KUA]C_A = E_{KR_{auth}}[T, ID_A, KU_A] lets participants exchange keys without contact with the authority.
  • X.509 defines the certificate format. The CA signs a hash of all the fields.
  • Merkle's simple scheme is safe only against eavesdropping. The scheme with two nonces and EKUb[EKRa[Ks]]E_{KU_b}[E_{KR_a}[K_s]] gives confidentiality and authentication.
  • The hybrid scheme keeps a KDC and uses public keys only for master keys, for performance and backward compatibility.