CSS411 Cryptography

Key Management

Slide deck 17. Key hierarchy, key distribution with a KDC and with public keys, public key distribution, X.509 and PKIX.

27 min read

Key distribution basicsSearch on YouTube

Why key management is hardSearch on YouTube

Key management and key distribution are complex topics. They include three types of issues:

  • Cryptographic issues.
  • Protocol issues: which party sends which message, and in which order.
  • Management issues: who stores, changes and revokes the keys.

The two scheme types have different needs:

Scheme typeWhat the parties needConcern
Symmetric schemesBoth parties share a common secret keyHow to distribute that key securely
Public key schemesEach party gets valid public keysHow to make sure that a key belongs to the claimed owner

Frequent key changes can be desirable. They limit the data that an attacker gets from one broken key.

Secure systems often fail because of a break in the key distribution scheme, not because of a weak cipher.

Distribution alternativesSearch on YouTube

Two parties AA and BB need a shared symmetric key. The slides give four alternatives:

  1. AA selects the key and physically delivers it to BB.
  2. A third party selects the key and delivers it to AA and BB.
  3. If AA and BB communicated previously, they use the previous key to encrypt a new key.
  4. If AA and BB each have secure communications with a third party CC, then CC relays the key between AA and BB.

Four alternatives: Hand, Third, Old, Relay. AA hands the key over, a third party delivers it, an old key encrypts the new key, or CC relays it.

Key hierarchySearch on YouTube

Systems typically use a hierarchy of keys:

KeyRoleLifetime
Session keyA temporary key. It encrypts the data between users for one logical session.Discarded after the session
Master keyEncrypts session keys. It is shared by a user and the Key Distribution Center (KDC).Long-lived

The slide figure shows three levels:

  • Data gets cryptographic protection from session keys.
  • Session keys get cryptographic protection from master keys.
  • Master keys get non-cryptographic protection. They can be distributed in a non-cryptographic way, such as physical delivery.

Each level protects the level above it. Only the small set of master keys needs a slow, physical delivery. All other keys move over the network in encrypted form.

Symmetric keys with a KDCSearch on YouTube

Key distribution scenarioSearch on YouTube

Figure 14.3 shows how a KDC gives a session key KsK_s to initiator AA and responder BB. AA shares master key KaK_a with the KDC, and BB shares KbK_b.

  1. A→A \to KDC: IDA ∥ IDB ∥ N1ID_A \,\Vert\, ID_B \,\Vert\, N_1. AA asks for a session key for BB and adds a nonce N1N_1.
  2. KDC →A\to A: E(Ka,[Ks ∥ IDA ∥ IDB ∥ N1]) ∥ E(Kb,[Ks ∥ IDA])E(K_a, [K_s \,\Vert\, ID_A \,\Vert\, ID_B \,\Vert\, N_1]) \,\Vert\, E(K_b, [K_s \,\Vert\, ID_A]).
  3. A→BA \to B: E(Kb,[Ks ∥ IDA])E(K_b, [K_s \,\Vert\, ID_A]). AA forwards the part for BB. BB now has KsK_s and knows the peer is AA.
  4. B→AB \to A: E(Ks,N2)E(K_s, N_2). BB sends a new nonce N2N_2 under the session key.
  5. A→BA \to B: E(Ks,f(N2))E(K_s, f(N_2)). AA applies a function ff to N2N_2, for example "add 1", and sends the result back.

Steps 1 to 3 are the key distribution steps. Steps 3 to 5 are the authentication steps.

N1N_1 lets AA match the reply to her request, so an attacker cannot replay an old reply. Steps 4 and 5 show BB that AA holds KsK_s and that step 3 is not a replay.

Key distribution issuesSearch on YouTube

  • Large networks need hierarchies of KDCs, but the KDCs must trust each other.
  • Session key lifetimes must be limited for greater security.
  • Automatic key distribution on behalf of users is possible, but the users must trust the system.
  • Decentralized key distribution is an alternative to one central KDC.
  • Controlling key usage: the system can limit what each key is used for.

Symmetric keys with public keysSearch on YouTube

Why use public keysSearch on YouTube

Public-key cryptosystems are inefficient. Thus they almost never encrypt data directly. They encrypt secret keys for distribution. After the exchange, both sides use fast symmetric encryption for the data.

Merkle's simple schemeSearch on YouTube

Merkle proposed a very simple scheme. It allows secure communications, and no keys exist before or after the exchange.

  1. A→BA \to B: PUa ∥ IDAPU_a \,\Vert\, ID_A. AA makes a new key pair and sends the public key and her identity.
  2. B→AB \to A: E(PUa,Ks)E(PU_a, K_s). BB makes a session key KsK_s and encrypts it with PUaPU_a.

AA decrypts with PRaPR_a to get KsK_s. Then AA discards PUaPU_a and PRaPR_a, and BB discards PUaPU_a.

Man-in-the-middle attackSearch on YouTube

This very simple scheme is vulnerable to an active man-in-the-middle attack. Figure 14.8 shows the attack by Darth:

  1. AA sends PUa ∥ IDAPU_a \,\Vert\, ID_A. Darth intercepts it.
  2. Darth makes his own key pair and sends PUd ∥ IDAPU_d \,\Vert\, ID_A to BB.
  3. BB sends E(PUd,Ks)E(PU_d, K_s). Darth intercepts it and computes Ks=D(PRd,E(PUd,Ks))K_s = D(PR_d, E(PU_d, K_s)).
  4. Darth sends E(PUa,Ks)E(PU_a, K_s) to AA.

At the end, Alice, Bob and Darth all share KsK_s. Alice and Bob do not know that Darth has the key.

Darth breaks no cipher. The scheme has no authentication of the public key, so an active attacker can replace it with his own key.

Confidentiality and authenticationSearch on YouTube

This scheme protects against the active attack. AA and BB already have each other's public keys.

  1. A→BA \to B: E(PUb,[N1 ∥ IDA])E(PU_b, [N_1 \,\Vert\, ID_A]). AA sends her identity and a nonce N1N_1.
  2. B→AB \to A: E(PUa,[N1 ∥ N2])E(PU_a, [N_1 \,\Vert\, N_2]). BB returns N1N_1 and adds his nonce N2N_2. Only BB can read message 1, so this proves the responder is BB.
  3. A→BA \to B: E(PUb,N2)E(PU_b, N_2). AA returns N2N_2, so BB knows the initiator is AA.
  4. A→BA \to B: E(PUb,E(PRa,Ks))E(PU_b, E(PR_a, K_s)). AA signs KsK_s with her private key and then encrypts it with BB's public key.

In step 4, the outer layer gives confidentiality: only BB can read KsK_s. The inner layer gives authentication: only AA can make that signature.

Hybrid key distributionSearch on YouTube

A hybrid scheme keeps a private-key KDC:

  • The KDC shares a secret master key with each user.
  • The KDC distributes session keys with the master keys.
  • Public-key encryption distributes the master keys. This is especially useful when the users are widely distributed.

The rationale:

  • Performance: public-key encryption is slow, so the system uses it only for the rare master key updates.
  • Backward compatibility: the existing KDC scheme stays in use with few changes.

Distribution of public keysSearch on YouTube

Four methodsSearch on YouTube

MethodMechanismWeakness
Public announcementUsers send or broadcast their public keysAnyone can forge a key
Publicly available directoryUsers register keys with a trusted directoryStill vulnerable to tampering or forgery
Public-key authorityThe authority gives out keys in signed repliesReal-time access to the authority is necessary
Public-key certificatesA CA signs a certificate for each keyA trusted CA is necessary

Public announcementSearch on YouTube

Users distribute public keys to recipients or broadcast them to the community at large. For example, users append PGP keys to email messages, or post them to news groups or email lists.

The major weakness is forgery. Anyone can create a key, claim to be someone else, and broadcast it. Until the forgery is discovered, the attacker can masquerade as the claimed user.

Publicly available directorySearch on YouTube

Users get greater security when they register keys with a public directory. The directory must be trusted and must have these properties:

  • It contains {name,public-key}\{name, public\text{-}key\} entries.
  • Participants register securely with the directory.
  • Participants can replace their key at any time.
  • The directory is periodically published.
  • The directory can be accessed electronically.

The directory is still vulnerable to tampering or forgery. For example, an attacker who gets the directory's private key can issue false keys.

Public-key authoritySearch on YouTube

The authority tightens control over the distribution of keys from the directory. It has the properties of the directory. Each user must know the public key of the authority, PUauthPU_{auth}. Then users get any desired public key from the authority securely.

The slide figure shows seven messages:

  1. A→A \to Authority: Request ∥ Time1Request \,\Vert\, Time_1.
  2. Authority →A\to A: E(PRauth,[PUb ∥ Request ∥ Time1])E(PR_{auth}, [PU_b \,\Vert\, Request \,\Vert\, Time_1]).
  3. A→BA \to B: E(PUb,[IDA ∥ N1])E(PU_b, [ID_A \,\Vert\, N_1]).
  4. B→B \to Authority: Request ∥ Time2Request \,\Vert\, Time_2.
  5. Authority →B\to B: E(PRauth,[PUa ∥ Request ∥ Time2])E(PR_{auth}, [PU_a \,\Vert\, Request \,\Vert\, Time_2]).
  6. B→AB \to A: E(PUa,[N1 ∥ N2])E(PU_a, [N_1 \,\Vert\, N_2]).
  7. A→BA \to B: E(PUb,N2)E(PU_b, N_2).

The timestamps show that each reply from the authority is fresh. Messages 6 and 7 authenticate AA and BB to each other.

The method has two problems. It needs real-time access to the directory when keys are necessary. The directory may also be vulnerable to tampering.

Public-key certificatesSearch on YouTube

Certificates allow key exchange without real-time access to the public-key authority.

  • A certificate binds an identity to a public key. It usually has other information, such as the period of validity and rights of use.
  • A trusted public-key or Certificate Authority (CA) signs all the contents.
  • Anyone who knows the public key of the authority can verify the certificate.

CA=E(PRauth,[Time1 ∥ IDA ∥ PUa])CB=E(PRauth,[Time2 ∥ IDB ∥ PUb])C_A = E(PR_{auth}, [Time_1 \,\Vert\, ID_A \,\Vert\, PU_a]) \qquad C_B = E(PR_{auth}, [Time_2 \,\Vert\, ID_B \,\Vert\, PU_b])

Each user sends its public key to the CA and gets a certificate back. Then AA sends CAC_A to BB, and BB sends CBC_B to AA.

X.509 certificatesSearch on YouTube

X.509 authentication serviceSearch on YouTube

  • X.509 is part of the CCITT X.500 directory service standards. X.500 uses distributed servers that keep a database of user information.
  • X.509 defines a framework for authentication services. The directory can store public-key certificates. Each certificate holds the public key of a user, signed by a certification authority.
  • X.509 also defines authentication protocols.
  • X.509 uses public-key cryptography and digital signatures. The algorithms are not standardised, but RSA is recommended.
  • X.509 certificates are widely used. There are 3 versions.

The slide "X.509 Certificate Use" shows how the CA signs a certificate:

  1. The CA computes a hash code HH of the unsigned certificate (user ID and the user's public key).
  2. The CA signs the hash code with the CA's private key.
  3. The CA appends the signature to the certificate.

A recipient verifies the signature with the CA's public key.

Certificate formatSearch on YouTube

A Certification Authority (CA) issues each certificate. The certificate contains these fields:

FieldContent
Version VV1, 2, or 3
Serial number SNSNUnique within the CA. It identifies the certificate.
Signature algorithm identifier AIAIAlgorithm and parameters
Issuer X.500 name CACAName of the CA
Period of validity TAT^ANot before and not after dates
Subject X.500 name AAName of the owner
Subject public-key info ApA_pAlgorithm, parameters and key
Issuer unique identifierVersion 2 and 3
Subject unique identifierVersion 2 and 3
Extension fieldsVersion 3 only
SignatureAlgorithm, parameters and the encrypted hash of all the other fields

The notation CA≪A≫CA \ll A \gg is the certificate of user AA signed by certification authority CACA.

Obtaining a certificateSearch on YouTube

  • Any user with access to the CA can get any certificate from it.
  • Only the CA can modify a certificate.
  • Certificates cannot be forged, so they can be placed in a public directory.

CA hierarchySearch on YouTube

  • If two users share a common CA, they are assumed to know the public key of that CA.
  • If not, the CAs must form a hierarchy.
  • Certificates link the members of the hierarchy, so a user can validate other CAs.
  • Each CA has certificates for its clients (forward) and for its parent (backward).
  • Each client trusts the certificates of its parents.
  • A user of any CA in the hierarchy can verify a certificate from any other CA in it.

In the "CA Hierarchy Use" figure, user AA has a certificate from CA XX, and user BB has one from CA ZZ. AA gets BB's public key with this chain:

X≪W≫  W≪V≫  V≪Y≫  Y≪Z≫  Z≪B≫X \ll W \gg \; W \ll V \gg \; V \ll Y \gg \; Y \ll Z \gg \; Z \ll B \gg

AA already trusts XX. Each certificate in the chain gives the public key that verifies the next certificate.

Certificate revocationSearch on YouTube

Each certificate has a period of validity. A CA may need to revoke a certificate before it expires, for example:

  1. The private key of the user is compromised.
  2. The user is no longer certified by this CA.
  3. The certificate of the CA is compromised.

Each CA keeps a list of revoked certificates, the Certificate Revocation List (CRL). Users must check certificates against the CRL of the CA.

The CRL contains the signature algorithm identifier, the issuer name, the "this update" date and the "next update" date. For each revoked certificate, it gives the user certificate serial number and the revocation date. The CA signs the full list.

Version 3 extensionsSearch on YouTube

Users need more information in a certificate, for example email or URL, policy details and usage constraints. Version 3 does not name new fields explicitly. It defines a general extension method. Each extension has:

  1. An extension identifier.
  2. A criticality indicator.
  3. An extension value.

There are three classes of certificate extensions:

Extension classPurpose
Key and policy informationGives information about the subject and issuer keys, plus indicators of certificate policy
Certificate subject and issuer attributesSupports alternative names, in alternative formats, for the subject and the issuer
Certificate path constraintsLets a CA put constraints on the use of certificates by other CAs

Public key infrastructureSearch on YouTube

PKIX modelSearch on YouTube

A Public Key Infrastructure (PKI) is the set of hardware, software, people, policies and procedures that create, manage, store, distribute and revoke certificates. PKIX is the PKI model based on X.509.

The slide figure shows these PKIX parts:

  • End entity: the PKI user.
  • Registration authority: an optional entity that does some administrative work for the CA.
  • Certificate authority: issues certificates and CRLs.
  • CRL issuer: an optional entity that publishes CRLs for the CA.
  • Certificate/CRL repository: the store from which end entities retrieve certificates and CRLs.

PKIX management functionsSearch on YouTube

  1. Registration
  2. Initialization
  3. Certification
  4. Key pair recovery
  5. Key pair update
  6. Revocation request
  7. Cross certification

The end entity uses the first six functions with the RA or CA. Cross certification happens between two CAs.

Seven PKIX functions, in order: "Rich Investors Collect Keys, Keep Records, Cross-check". Registration, Initialization, Certification, Key pair recovery, Key pair update, Revocation request, Cross certification.

Quick self-testSearch on YouTube

What are the four key distribution alternatives for symmetric keys?

AA selects the key and physically delivers it to BB. A third party selects the key and delivers it to AA and BB. AA and BB use a previous key to encrypt a new key. A third party CC with secure links to both relays the key.

Compare session keys and master keys.

A session key is temporary. It encrypts data between users for one logical session and is then discarded. A master key encrypts session keys and is shared by a user and the KDC. Master keys get non-cryptographic protection, such as physical delivery.

Give the five messages of the KDC key distribution scenario.

(1) A→A \to KDC: IDA∥IDB∥N1ID_A \Vert ID_B \Vert N_1. (2) KDC →A\to A: E(Ka,[Ks∥IDA∥IDB∥N1])∥E(Kb,[Ks∥IDA])E(K_a, [K_s \Vert ID_A \Vert ID_B \Vert N_1]) \Vert E(K_b, [K_s \Vert ID_A]). (3) A→BA \to B: E(Kb,[Ks∥IDA])E(K_b, [K_s \Vert ID_A]). (4) B→AB \to A: E(Ks,N2)E(K_s, N_2). (5) A→BA \to B: E(Ks,f(N2))E(K_s, f(N_2)).

How does Merkle's simple scheme work, and why is it vulnerable?

AA sends PUa∥IDAPU_a \Vert ID_A. BB returns E(PUa,Ks)E(PU_a, K_s). The public key is not authenticated. Darth replaces PUaPU_a with PUdPU_d, reads KsK_s, and forwards E(PUa,Ks)E(PU_a, K_s) to AA. Then all three share KsK_s.

Give the four messages of secret key distribution with confidentiality and authentication.

(1) E(PUb,[N1∥IDA])E(PU_b, [N_1 \Vert ID_A]). (2) E(PUa,[N1∥N2])E(PU_a, [N_1 \Vert N_2]). (3) E(PUb,N2)E(PU_b, N_2). (4) E(PUb,E(PRa,Ks))E(PU_b, E(PR_a, K_s)). The outer layer of message 4 gives confidentiality. The inner signature gives authentication.

What is hybrid key distribution and why use it?

A private-key KDC shares a master key with each user and distributes session keys with the master keys. Public-key encryption distributes the master keys. The rationale is performance and backward compatibility.

Compare the four methods of public key distribution.

Public announcement is open to forgery. A public directory is still open to tampering or forgery. A public-key authority needs real-time access. Certificates signed by a CA allow key exchange without real-time access to an authority.

List the fields of an X.509 certificate.

Version, serial number, signature algorithm identifier, issuer name, period of validity, subject name and subject public-key info. Then the issuer and subject unique identifiers (v2+), extensions (v3) and the signature.

When must a CA revoke a certificate, and how do users find out?

There are three cases. The private key of the user is compromised. The user is no longer certified by the CA. The certificate of the CA is compromised. The CA puts the certificate on its CRL. Users check the CRL.

Give the seven PKIX management functions.

Registration, initialization, certification, key pair recovery, key pair update, revocation request and cross certification.

  • Symmetric schemes need secure distribution of a shared key. Public-key schemes need valid public keys.
  • Session keys protect data, master keys protect session keys, and master keys get physical delivery.
  • A KDC gives KsK_s to AA and BB in five messages. Nonces N1N_1 and N2N_2 give freshness and authentication.
  • Merkle's scheme is open to a man-in-the-middle attack. The four-message scheme with nonces and a signature gives confidentiality and authentication.
  • Public keys are distributed by announcement, directory, authority or certificates.
  • X.509 certificates are signed by a CA. CA hierarchies, CRLs and version 3 extensions extend the scheme. PKIX has seven management functions.