Skip to main content

Concise Binary Object Representation (CBOR)
RFC 8949 also known as STD 94

Document Type RFC - Internet Standard (December 2020)
Obsoletes RFC 7049
Authors Carsten Bormann , Paul E. Hoffman
Last updated 2020-12-04
RFC stream Internet Engineering Task Force (IETF)
Formats
Additional resources Mailing list discussion
IESG Responsible AD Barry Leiba
Send notices to (None)
RFC 8949


Internet Engineering Task Force (IETF)                        C. Bormann
Request for Comments: 8949                        Universität Bremen TZI
STD: 94                                                       P. Hoffman
Obsoletes: 7049                                                    ICANN
Category: Standards Track                                  December 2020
ISSN: 2070-1721

              Concise Binary Object Representation (CBOR)

Abstract

   The Concise Binary Object Representation (CBOR) is a data format
   whose design goals include the possibility of extremely small code
   size, fairly small message size, and extensibility without the need
   for version negotiation.  These design goals make it different from
   earlier binary serializations such as ASN.1 and MessagePack.

   This document obsoletes RFC 7049, providing editorial improvements,
   new details, and errata fixes while keeping full compatibility with
   the interchange format of RFC 7049.  It does not create a new version
   of the format.

Status of This Memo

   This is an Internet Standards Track document.

   This document is a product of the Internet Engineering Task Force
   (IETF).  It represents the consensus of the IETF community.  It has
   received public review and has been approved for publication by the
   Internet Engineering Steering Group (IESG).  Further information on
   Internet Standards is available in Section 2 of RFC 7841.

   Information about the current status of this document, any errata,
   and how to provide feedback on it may be obtained at
   https://www.rfc-editor.org/info/rfc8949.

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
   (https://trustee.ietf.org/license-info) 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
     1.1.  Objectives
     1.2.  Terminology
   2.  CBOR Data Models
     2.1.  Extended Generic Data Models
     2.2.  Specific Data Models
   3.  Specification of the CBOR Encoding
     3.1.  Major Types
     3.2.  Indefinite Lengths for Some Major Types
       3.2.1.  The "break" Stop Code
       3.2.2.  Indefinite-Length Arrays and Maps
       3.2.3.  Indefinite-Length Byte Strings and Text Strings
       3.2.4.  Summary of Indefinite-Length Use of Major Types
     3.3.  Floating-Point Numbers and Values with No Content
     3.4.  Tagging of Items
       3.4.1.  Standard Date/Time String
       3.4.2.  Epoch-Based Date/Time
       3.4.3.  Bignums
       3.4.4.  Decimal Fractions and Bigfloats
       3.4.5.  Content Hints
         3.4.5.1.  Encoded CBOR Data Item
         3.4.5.2.  Expected Later Encoding for CBOR-to-JSON Converters
         3.4.5.3.  Encoded Text
       3.4.6.  Self-Described CBOR
   4.  Serialization Considerations
     4.1.  Preferred Serialization
     4.2.  Deterministically Encoded CBOR
       4.2.1.  Core Deterministic Encoding Requirements
       4.2.2.  Additional Deterministic Encoding Considerations
       4.2.3.  Length-First Map Key Ordering
   5.  Creating CBOR-Based Protocols
     5.1.  CBOR in Streaming Applications
     5.2.  Generic Encoders and Decoders
     5.3.  Validity of Items
       5.3.1.  Basic validity
       5.3.2.  Tag validity
     5.4.  Validity and Evolution
     5.5.  Numbers
     5.6.  Specifying Keys for Maps
       5.6.1.  Equivalence of Keys
     5.7.  Undefined Values
   6.  Converting Data between CBOR and JSON
     6.1.  Converting from CBOR to JSON
     6.2.  Converting from JSON to CBOR
   7.  Future Evolution of CBOR
     7.1.  Extension Points
     7.2.  Curating the Additional Information Space
   8.  Diagnostic Notation
     8.1.  Encoding Indicators
   9.  IANA Considerations
     9.1.  CBOR Simple Values Registry
     9.2.  CBOR Tags Registry
     9.3.  Media Types Registry
     9.4.  CoAP Content-Format Registry
     9.5.  Structured Syntax Suffix Registry
   10. Security Considerations
   11. References
     11.1.  Normative References
     11.2.  Informative References
   Appendix A.  Examples of Encoded CBOR Data Items
   Appendix B.  Jump Table for Initial Byte
   Appendix C.  Pseudocode
   Appendix D.  Half-Precision
   Appendix E.  Comparison of Other Binary Formats to CBOR's Design
           Objectives
     E.1.  ASN.1 DER, BER, and PER
     E.2.  MessagePack
     E.3.  BSON
     E.4.  MSDTP: RFC 713
     E.5.  Conciseness on the Wire
   Appendix F.  Well-Formedness Errors and Examples
     F.1.  Examples of CBOR Data Items That Are Not Well-Formed
Show full document