Network Working Group S. Raza
Internet-Draft J. Höglund
Intended status: Standards Track RISE AB
Expires: January 14, 2021 G. Selander
J. Mattsson
Ericsson AB
M. Furuhed
Nexus Group
July 13, 2020

CBOR Profile of X.509 Certificates


This document specifies a CBOR encoding/compression of RFC 7925 profiled certificates. By using the fact that the certificates are profiled, the CBOR certificate compression algorithms can in many cases compress RFC 7925 profiled certificates with over 50%. This document also specifies COSE headers for CBOR encoded certificates as well as the use of the CBOR certificate compression algorithm with TLS Certificate Compression in TLS 1.3 and DTLS 1.3.

Status of This Memo

This Internet-Draft is submitted in full conformance with the provisions of BCP 78 and BCP 79.

Internet-Drafts are working documents of the Internet Engineering Task Force (IETF). Note that other groups may also distribute working documents as Internet-Drafts. The list of current Internet-Drafts is at

Internet-Drafts are draft documents valid for a maximum of six months and may be updated, replaced, or obsoleted by other documents at any time. It is inappropriate to use Internet-Drafts as reference material or to cite them other than as "work in progress."

This Internet-Draft will expire on January 14, 2021.

Copyright Notice

Copyright (c) 2020 IETF Trust and the persons identified as the document authors. All rights reserved.

This document is subject to BCP 78 and the IETF Trust's Legal Provisions Relating to IETF Documents ( in effect on the date of publication of this document. Please review these documents carefully, as they describe your rights and restrictions with respect to this document. Code Components extracted from this document must include Simplified BSD License text as described in Section 4.e of the Trust Legal Provisions and are provided without warranty as described in the Simplified BSD License.

Table of Contents

1. Introduction

One of the challenges with deploying a Public Key Infrastructure (PKI) for the Internet of Things (IoT) is the size and encoding of X.509 public key certificates [RFC5280], since those are not optimized for constrained environments [RFC7228]. More compact certificate representations are desirable. Due to the current PKI usage of X.509 certificates, keeping X.509 compatibility is necessary at least for a transition period. However, the use of a more compact encoding with the Concise Binary Object Representation (CBOR) [RFC7049] reduces the certificate size significantly which has known performance benefits in terms of decreased communication overhead, power consumption, latency, storage, etc.

CBOR is a data format designed for small code size and small message size. CBOR builds on the JSON data model but extends it by e.g. encoding binary data directly without base64 conversion. In addition to the binary CBOR encoding, CBOR also has a diagnostic notation that is readable and editable by humans. The Concise Data Definition Language (CDDL) [RFC8610] provides a way to express structures for protocol messages and APIs that use CBOR. [RFC8610] also extends the diagnostic notation.

CBOR data items are encoded to or decoded from byte strings using a type-length-value encoding scheme, where the three highest order bits of the initial byte contain information about the major type. CBOR supports several different types of data items, in addition to integers (int, uint), simple values (e.g. null), byte strings (bstr), and text strings (tstr), CBOR also supports arrays [] of data items, maps {} of pairs of data items, and sequences of data items. For a complete specification and examples, see [RFC7049], [RFC8610], and [RFC8742].

RFC 7925 [RFC7925] specifies a certificate profile for Internet of Things deployments which can be applied for lightweight certificate based authentication with e.g. TLS [RFC8446], DTLS [I-D.ietf-tls-dtls13], COSE [RFC8152], or EDHOC [I-D.ietf-lake-edhoc]. This document specifies the CBOR encoding/compression of RFC 7925 profiled X.509 certificates based on [X.509-IoT]. Two variants are defined using exactly the same CBOR encoding and differing only in what is being signed:

Other work has looked at reducing the size of X.509 certificates. The purpose of this document is to stimulate a discussion on CBOR based certificates: what field values (in particular for ‘issuer’/’subject’) are relevant for constrained IoT applications, what is the maximum compression that can be expected with CBOR, and what is the right trade-off between compactness and generality.

This document specifies COSE headers for use of the CBOR certificate encoding with COSE. The document also specifies the CBOR certificate compression algorithm for use as TLS Certificate Compression with TLS 1.3 and DTLS 1.3.

2. Notational Conventions

The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “NOT RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described in BCP 14 [RFC2119] [RFC8174] when, and only when, they appear in all capitals, as shown here.

This specification makes use of the terminology in [RFC7228].

3. CBOR Encoding

This section specifies the content and encoding for CBOR certificates, with the overall objective to produce a very compact representation of the certificate profile defined in [RFC7925]. The CBOR certificate can be either a CBOR compressed X.509 certificate, in which case the signature is calculated on the DER encoded ASN.1 data in the X.509 certificate, or a native CBOR certificate, in which case the signature is calculated directly on the CBOR encoded data (see Section 6). In both cases the certificate content is adhering to the restrictions given by [RFC7925]. The corresponding ASN.1 schema is given in Appendix A.

The encoding and compression has several components including: ASN.1 DER and base64 encoding are replaced with CBOR encoding, static fields are elided, and elliptic curve points are compressed. The X.509 fields and their CBOR encodings are listed below. Combining these different components reduces the certificate size significantly, which is not possible with general purpose compressions algorithms, see Figure 1.

CBOR certificates are defined in terms of RFC 7925 profiled X.509 certificates:

   subjectAltName = 1
   basicConstraints = 2 + cA
   keyUsage = 3 + digitalSignature
            + 2 * keyAgreement + 4 * keyCertSign
   extKeyUsage = 10 + id-kp-serverAuth + 2 * id-kp-clientAuth
               + 4 * id-kp-codeSigning + 8 * id-kp-OCSPSigning

In addition to the above fields present in X.509, the CBOR ecoding introduces an additional field

The following Concise Data Definition Language (CDDL) defines a group, the elements of which are to be used in an unadorned CBOR Sequence [RFC8742]. The member names therefore only have documentary value.

certificate = (
   type : int,
   serialNumber : bytes,
   issuer : { + int => bytes } / text,
   validity_notBefore: uint,
   validity_notAfter: uint,
   subject : text / bytes
   subjectPublicKey : bytes
   extensions : [ *4 int, ? text / bytes ] / int,
   signatureValue : bytes,
   ? ( signatureAlgorithm : int,
       subjectPublicKeyInfo_algorithm : int )

The signatureValue for native CBOR certificates is calculated over the CBOR sequence:

   type : int,
   serialNumber : bytes,
   issuer : { + int => bytes } / text,
   validity_notBefore: uint,
   validity_notAfter: uint,
   subject : text / bytes
   subjectPublicKey : bytes
   extensions : [ *4 int, ? text / bytes ] / int,
   ? ( signatureAlgorithm : int,
       subjectPublicKeyInfo_algorithm : int )

TODO - Specify exactly how issuer is encoded into a map / text and back again. This is a compromise between compactness and complete generality.

4. Deployment settings

CBOR certificates can be deployed with legacy X.509 certificates and CA infrastructure. In order to verify the signature, the CBOR certificate is used to recreate the original X.509 data structure to be able to verify the signature.

For protocols like TLS/DTLS 1.2, where the handshake is sent unencrypted, the actual encoding and compression can be done at different locations depending on the deployment setting. For example, the mapping between CBOR certificate and standard X.509 certificate can take place in a 6LoWPAN border gateway which allows the server side to stay unmodified. This case gives the advantage of the low overhead of a CBOR certificate over a constrained wireless links. The conversion to X.509 within an IoT device will incur a computational overhead, however, measured in energy this is negligible compared to the reduced communication overhead.

For the setting with constrained server and server-only authentication, the server only needs to be provisioned with the CBOR certificate and does not perform the conversion to X.509. This option is viable when client authentication can be asserted by other means.

For protocols like IKEv2, TLS/DTLS 1.3, and EDHOC, where certificates are encrypted, the proposed encoding needs to be done fully end-to-end, through adding the encoding/decoding functionality to the server.

5. Expected Certificate Sizes

The CBOR encoding of the sample certificate given in Appendix A results in the numbers shown in Figure 1. After RFC 7925 profiling, most duplicated information has been removed, and the remaining text strings are minimal in size. Therefore the further size reduction reached with general compression mechanisms will be small, mainly corresponding to making the ASN.1 endcoding more compact. The zlib number was calculated with zlib-flate.

zlib-flate -compress < cert.der > cert.compressed
|                  |   RFC 7925   |    zlib    |  CBOR Certificate  |
| Certificate Size |     314      |     295    |         136        |

Figure 1: Comparing Sizes of Certificates (bytes)

6. Native CBOR Certificates

The difference between CBOR compressed X.509 certificate and native CBOR certificate is that the signature is calculated over the CBOR encoding rather than the DER encoded ASN.1 data. This removes entirely the need for ASN.1 DER and base64 encoding which reduces the processing in the authenticating devices, and avoids known complexities with these encodings.

Native CBOR certificates can be applied in devices that are only required to authenticate to native CBOR certificate compatible servers. This is not a major restriction for many IoT deployments, where the parties issuing and verifying certificates can be a restricted ecosystem which not necessarily involves public CAs.

CBOR compressed X.509 certificates provides an intermediate step between RFC 7925 profiled X.509 certificates and native CBOR certificates: An implementation of CBOR compressed X.509 certificates contains both the CBOR encoding of the X.509 certificate and the signature operations sufficient for native CBOR certificates.

7. Security Considerations

The CBOR profiling of X.509 certificates does not change the security assumptions needed when deploying standard X.509 certificates but decreases the number of fields transmitted, which reduces the risk for implementation errors.

Conversion between the certificate formats can be made in constant time to reduce risk of information leakage through side channels.

The mechanism in this draft does not reveal any additional information compared to X.509. Because of difference in size, it will be possible to detect that this profile is used. The gateway solution described in Section 4 requires unencrypted certificates and is not recommended.

8. IANA Considerations

For all items, the ‘Reference’ field points to this document.

8.1. CBOR Certificate Types Registry

IANA has created a new registry titled “CBOR Certificate Types” under the new heading “CBOR Certificate”. The registration procedure is “Expert Review”. The columns of the registry are Value, Description, and Reference, where Value is an integer and the other columns are text strings. The initial contents of the registry are:

| Value | Description                           |
|     0 | Native CBOR Certificate.              |
|     1 | CBOR Compressed X.509 Certificate     |

Figure 2: CBOR Certificate Types

8.2. CBOR Certificate Signature Algorithms Registry

IANA has created a new registry titled “CBOR Certificate Signature Algorithms” under the new heading “CBOR Certificate”. The registration procedure is “Expert Review”. The columns of the registry are Value, X.509 Algorithm, and Reference, where Value is an integer and the other columns are text strings. The initial contents of the registry are:

| Value | X.509 Signature Algorithm             |
|     0 | ecdsa-with-SHA384                     |
|     1 | ecdsa-with-SHA512                     |
|     2 | id-ecdsa-with-shake128                |
|     3 | id-ecdsa-with-shake256                |
|     4 | id-Ed25519                            |
|     5 | id-Ed448                              |

Figure 3: CBOR Certificate Signature Algorithms

8.3. CBOR Certificate Public Key Algorithms Registry

IANA has created a new registry titled “CBOR Certificate Public Key Algorithms” under the new heading “CBOR Certificate”. The registration procedure is “Expert Review”. The columns of the registry are Value, X.509 Algorithm, and Reference, where Value is an integer and the other columns are text strings. The initial contents of the registry are:

| Value | X.509 Public Key Algorithm            |
|     0 | id-ecPublicKey + prime384v1           |
|     1 | id-ecPublicKey + prime512v1           |
|     2 | id-X25519                             |
|     3 | id-X448                               |
|     4 | id-Ed25519                            |
|     5 | id-Ed448                              |

Figure 4: CBOR Certificate Public Key Algorithms

8.4. COSE Header Parameters Registry

This document registers the following entries in the “COSE Header Parameters” registry under the “CBOR Object Signing and Encryption (COSE)” heading. The formatting and processing are the same as the corresponding x5chain and x5u defined in [I-D.ietf-cose-x509] except that the certificates are CBOR encoded instead of DER encoded.

| Name      | Label | Value Type     | Description         |
| CBORchain | TBD1  | COSE_CBOR_Cert | An ordered chain of |
|           |       |                | CBOR certificates   |
| CBORu     | TBD2  | uri            | URI pointing to a   |
|           |       |                | CBOR certificate    |

8.5. TLS Certificate Compression Algorithm IDs Registry

This document registers the following entry in the “Certificate Compression Algorithm IDs” registry under the “Transport Layer Security (TLS) Extensions” heading.

| Algorithm Number | Description                  |
| TBD3             | CBOR Certificate             |

9. References

9.1. Normative References

[I-D.ietf-tls-certificate-compression] Ghedini, A. and V. Vasiliev, "TLS Certificate Compression", Internet-Draft draft-ietf-tls-certificate-compression-10, January 2020.
[I-D.ietf-tls-dtls13] Rescorla, E., Tschofenig, H. and N. Modadugu, "The Datagram Transport Layer Security (DTLS) Protocol Version 1.3", Internet-Draft draft-ietf-tls-dtls13-38, May 2020.
[RFC2119] Bradner, S., "Key words for use in RFCs to Indicate Requirement Levels", BCP 14, RFC 2119, DOI 10.17487/RFC2119, March 1997.
[RFC5280] Cooper, D., Santesson, S., Farrell, S., Boeyen, S., Housley, R. and W. Polk, "Internet X.509 Public Key Infrastructure Certificate and Certificate Revocation List (CRL) Profile", RFC 5280, DOI 10.17487/RFC5280, May 2008.
[RFC7049] Bormann, C. and P. Hoffman, "Concise Binary Object Representation (CBOR)", RFC 7049, DOI 10.17487/RFC7049, October 2013.
[RFC7925] Tschofenig, H. and T. Fossati, "Transport Layer Security (TLS) / Datagram Transport Layer Security (DTLS) Profiles for the Internet of Things", RFC 7925, DOI 10.17487/RFC7925, July 2016.
[RFC8152] Schaad, J., "CBOR Object Signing and Encryption (COSE)", RFC 8152, DOI 10.17487/RFC8152, July 2017.
[RFC8174] Leiba, B., "Ambiguity of Uppercase vs Lowercase in RFC 2119 Key Words", BCP 14, RFC 8174, DOI 10.17487/RFC8174, May 2017.
[RFC8446] Rescorla, E., "The Transport Layer Security (TLS) Protocol Version 1.3", RFC 8446, DOI 10.17487/RFC8446, August 2018.
[RFC8610] Birkholz, H., Vigano, C. and C. Bormann, "Concise Data Definition Language (CDDL): A Notational Convention to Express Concise Binary Object Representation (CBOR) and JSON Data Structures", RFC 8610, DOI 10.17487/RFC8610, June 2019.
[RFC8742] Bormann, C., "Concise Binary Object Representation (CBOR) Sequences", RFC 8742, DOI 10.17487/RFC8742, February 2020.

9.2. Informative References

[I-D.ietf-cose-x509] Schaad, J., "CBOR Object Signing and Encryption (COSE): Header parameters for carrying and referencing X.509 certificates", Internet-Draft draft-ietf-cose-x509-06, March 2020.
[I-D.ietf-lake-edhoc] Selander, G., Mattsson, J. and F. Palombini, "Ephemeral Diffie-Hellman Over COSE (EDHOC)", Internet-Draft draft-ietf-lake-edhoc-00, July 2020.
[RFC7228] Bormann, C., Ersue, M. and A. Keranen, "Terminology for Constrained-Node Networks", RFC 7228, DOI 10.17487/RFC7228, May 2014.
[SECG] "Elliptic Curve Cryptography, Standards for Efficient Cryptography Group, ver. 2", 2009.
[X.509-IoT] Forsby, F., Furuhed, M., Papadimitratos, P. and S. Raza, "Lightweight X.509 Digital Certificates for the Internet of Things.", Springer, Cham. Lecture Notes of the Institute for Computer Sciences, Social Informatics and Telecommunications Engineering, vol 242., July 2018.

Appendix A. Example CBOR Certificates

A.1. Example X.509 Certificate

Example of RFC 7925 profiled X.509 certificate parsed with OpenSSL.

        Version: 3 (0x2)
        Serial Number: 128269 (0x1f50d)
        Signature Algorithm: ecdsa-with-SHA256
        Issuer: CN=RFC test CA
            Not Before: Jan  1 00:00:00 2020 GMT
            Not After : Feb  2 00:00:00 2021 GMT
        Subject: CN=01-23-45-FF-FE-67-89-AB
        Subject Public Key Info:
            Public Key Algorithm: id-ecPublicKey
                Public-Key: (256 bit)
                ASN1 OID: prime256v1
                NIST CURVE: P-256
        X509v3 extensions:
            X509v3 Key Usage: 
                Digital Signature
    Signature Algorithm: ecdsa-with-SHA256

The DER encoding of the above certificate is 314 bytes.


A.2. Example CBOR Certificate Compression

The CBOR certificate compression of the X.509 in CBOR diagnostic format is:

  "RFC test CA",

The CBOR encoding (CBOR sequence) of the CBOR certificate is 136 bytes.


A.3. Example Native CBOR Certificate

The corresponding native CBOR certificate in CBOR diagnostic format is identical except for type and signatureValue.

  "RFC test CA",

The CBOR encoding (CBOR sequence) of the CBOR certificate is 136 bytes.


Appendix B. X.509 Certificate Profile, ASN.1

TODO - This ASN.1 profile should probably be in a document that updates RFC 7925.


Certificate  ::= SEQUENCE {
  tbsCertificate        TBSCertificate,
  signatureAlgorithm    AlgorithmIdentifier,
  signatureValue        BIT STRING

TBSCertificate  ::= SEQUENCE {
  version           [0] INTEGER {v3(2)},
  serialNumber          INTEGER (1..MAX),
  signature             AlgorithmIdentifier,
  issuer                Name,
  validity              Validity,
  subject               Name,
  subjectPublicKeyInfo  SubjectPublicKeyInfo,
  extensions        [3] Extensions OPTIONAL

Name  ::= SEQUENCE SIZE (1) OF DistinguishedName

DistinguishedName  ::= SET SIZE (1) OF CommonName

CommonName  ::= SEQUENCE {
  type              OBJECT IDENTIFIER (id-at-commonName),
  value             UTF8String

Validity  ::= SEQUENCE {
  notBefore         UTCTime,
  notAfter          UTCTime

SubjectPublicKeyInfo  ::= SEQUENCE {
  algorithm         AlgorithmIdentifier,
  subjectPublicKey  BIT STRING

AlgorithmIdentifier  ::=  SEQUENCE  {
  algorithm         OBJECT IDENTIFIER,
  parameters        ANY DEFINED BY algorithm OPTIONAL  }

Extensions  ::= SEQUENCE SIZE (1..MAX) OF Extension

Extension  ::= SEQUENCE {
  extnId            OBJECT IDENTIFIER,
  critical          BOOLEAN DEFAULT FALSE,
  extnValue         OCTET STRING

id-at-commonName    OBJECT IDENTIFIER   ::=
         {joint-iso-itu-t(2) ds(5) attributeType(4) 3}


Authors' Addresses

Shahid Raza RISE AB EMail:
Joel Höglund RISE AB EMail:
Göran Selander Ericsson AB EMail:
John Preuß Mattsson Ericsson AB EMail:
Martin Furuhed Nexus Group EMail: