Basics: The Key Usage Certificate Extension

Certificate extensions were introduced with version 3 of the X.509 standard. The Key Usage extension is an optional certificate extension that can be used in the RFC 5280 is defined and is used to limit the allowed uses for a key.

This is a simple bitmask.

KeyUsage ::= BIT STRING {
  digitalSignature (0),
  nonRepudiation (1),
  keyEncipherment (2),
  dataEncipherment (3),
  keyAgreement (4),
  keyCertSign (5),
  cRLSign (6),
  encipherOnly (7),
  decipherOnly (8)
}

However, the representation of the bit mask is usually in hexadecimal form.

BitHexDescriptionLabel
80x0decipherOnlyDecrypt only, in conjunction with keyAgreement
70x1encipherOnlyEncrypt only, in conjunction with keyAgreement
60x2cRLSignSigning blacklists
50x4keyCertSignSigning certificates
40x8keyAgreementUsed, for example, for data encryption with the Diffie-Hellman method
30x10dataEnciphermentData encryption, directly with the key contained in the certificate
20x20keyEnciphermentKey encryption, i.e. when a symmetric key is used for data encryption and this is encrypted with the key contained in the certificate
10x40nonRepudiationNon-repudiation
00x80digitalSignatureDigital signature

Typical examples of common use cases for certificates

Certification Authority Certificates

Certification authority certificates must have a key usage extension according to RRC 5280. This should be marked as critical. The extension will typically include keyCertSign and keyCrlSign. The Microsoft Certificate Authority will also include digitalSignature, but this should not be done according to RFC 5280.

There is the possibility, configure the Key Usage extension differently when installing a certificate authority.

TLS web server certificates

At TLS web server certificates it depends on which type of key is used (see RFC 5246 and RFC 4492).

Key algorithmValue
RSASignature and Encryption
ECDSASignature
ECDHSignature and Encryption

S/MIME certificates

With Secure/Multipurpose Internet Mail Extensions (S/MIME), two operations are basically possible with regard to e-mail messages:

  • Signing sent messages or verifying the signatures of received messages
  • Encrypt messages sent or decrypt messages received

When configuring the certificates, you have the choice of using a hybrid certificate (which supports both operations) or separate certificates for both operations.

Type of certificateKey Usage Extension
Encrypt/Decrypt onlykeyEncipherment (0x20)
Sign/verify onlydigitalSignature (0x80)
both operations (hybrid certificate)digitalSignature, keyEncipherment (0xA0)

Calculate with the Key Usage extension

A very simple way to calculate a key usage is possible with Windows PowerShell.

An example: digitalSignature (0x80) and keyEncipherment (0x20) together result in 0xA0.

"{0:x}" -f (0x80 -bor 0x20)

Related links

External sources

en_USEnglish