datatracker.ietf.org
Sign in
Version 5.4.0, 2014-04-22
Report a bug

Concise Binary Object Representation (CBOR)
RFC 7049

Document type: RFC - Proposed Standard (October 2013; Errata)
Was draft-bormann-cbor (individual in app area)
Document stream: IETF
Last updated: 2013-10-25
Other versions: plain text, pdf, html

IETF State: (None)
Consensus: Yes
Document shepherd: John Levine
Shepherd Write-Up: Last changed 2013-08-27

IESG State: RFC 7049 (Proposed Standard)
IANA Action State: RFC-Ed-Ack
Responsible AD: Barry Leiba
Send notices to: draft-bormann-cbor@tools.ietf.org, johnl@iecc.com

Internet Engineering Task Force (IETF)                        C. Bormann
Request for Comments: 7049                       Universitaet Bremen TZI
Category: Standards Track                                     P. Hoffman
ISSN: 2070-1721                                           VPN Consortium
                                                            October 2013

              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.

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 5741.

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

Copyright Notice

   Copyright (c) 2013 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
   (http://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.

Bormann & Hoffman            Standards Track                    [Page 1]
RFC 7049                          CBOR                      October 2013

Table of Contents

   1.  Introduction  . . . . . . . . . . . . . . . . . . . . . . . .   3
     1.1.  Objectives  . . . . . . . . . . . . . . . . . . . . . . .   4
     1.2.  Terminology . . . . . . . . . . . . . . . . . . . . . . .   5
   2.  Specification of the CBOR Encoding  . . . . . . . . . . . . .   6
     2.1.  Major Types . . . . . . . . . . . . . . . . . . . . . . .   7
     2.2.  Indefinite Lengths for Some Major Types . . . . . . . . .   9
       2.2.1.  Indefinite-Length Arrays and Maps . . . . . . . . . .   9
       2.2.2.  Indefinite-Length Byte Strings and Text Strings . . .  11
     2.3.  Floating-Point Numbers and Values with No Content . . . .  12
     2.4.  Optional Tagging of Items . . . . . . . . . . . . . . . .  14
       2.4.1.  Date and Time . . . . . . . . . . . . . . . . . . . .  16
       2.4.2.  Bignums . . . . . . . . . . . . . . . . . . . . . . .  16
       2.4.3.  Decimal Fractions and Bigfloats . . . . . . . . . . .  17
       2.4.4.  Content Hints . . . . . . . . . . . . . . . . . . . .  18
         2.4.4.1.  Encoded CBOR Data Item  . . . . . . . . . . . . .  18
         2.4.4.2.  Expected Later Encoding for CBOR-to-JSON
                   Converters  . . . . . . . . . . . . . . . . . . .  18
         2.4.4.3.  Encoded Text  . . . . . . . . . . . . . . . . . .  19
       2.4.5.  Self-Describe CBOR  . . . . . . . . . . . . . . . . .  19
   3.  Creating CBOR-Based Protocols . . . . . . . . . . . . . . . .  20
     3.1.  CBOR in Streaming Applications  . . . . . . . . . . . . .  20
     3.2.  Generic Encoders and Decoders . . . . . . . . . . . . . .  21
     3.3.  Syntax Errors . . . . . . . . . . . . . . . . . . . . . .  21
       3.3.1.  Incomplete CBOR Data Items  . . . . . . . . . . . . .  22
       3.3.2.  Malformed Indefinite-Length Items . . . . . . . . . .  22
       3.3.3.  Unknown Additional Information Values . . . . . . . .  23
     3.4.  Other Decoding Errors . . . . . . . . . . . . . . . . . .  23
     3.5.  Handling Unknown Simple Values and Tags . . . . . . . . .  24
     3.6.  Numbers . . . . . . . . . . . . . . . . . . . . . . . . .  24
     3.7.  Specifying Keys for Maps  . . . . . . . . . . . . . . . .  25
     3.8.  Undefined Values  . . . . . . . . . . . . . . . . . . . .  26
     3.9.  Canonical CBOR  . . . . . . . . . . . . . . . . . . . . .  26
     3.10. Strict Mode . . . . . . . . . . . . . . . . . . . . . . .  28
   4.  Converting Data between CBOR and JSON . . . . . . . . . . . .  29
     4.1.  Converting from CBOR to JSON  . . . . . . . . . . . . . .  29
     4.2.  Converting from JSON to CBOR  . . . . . . . . . . . . . .  30

[include full document text]