跳至正文
Wener Notes

CBOR

约 2 分钟阅读
标签:RFC
  • - Concise Binary Object Representation
    • RFC 8949
    • JSON 的二进制替代
    • 可替代 Protocol Buffers、MessagePack 等场景
    • 一般会和 JSON 混合使用
  • 优势
    • 更紧凑 二进制
    • 解析速度更快
    • 支持更多数据类型
    • 支持通过标签扩展数据类型
  • 适用场景
    • 带宽有限 - 减少传输数据量
    • 空间有限 - 减少存储数据量
    • 算力有限 - 加快解析速度
    • IoT、SOA、需要性能、需要减少带宽、高效传输
  • adopted by
    • 安全通信/生物认证 - 生物识别身份验证, 安全通信协议的元数据编码
      • FIDO2/WebAuthn - 用于无密码身份验证的协议,CBOR 编码认证请求和响应。
      • COSE(CBOR Object Signing and Encryption):用于签名、加密和密钥分发。
    • WebIntegraty
    • Web/HTTP
      • Amazon IOT
      • JSON Patch with CBOR
    • Blockchain
      • Cardano(ADA):Cardano 区块链使用 CBOR 编码交易数据
      • COSE(CBOR Object Signing and Encryption):一种基于 CBOR 的加密和签名标准,适用于区块链交易和智能合约。
    • IoT - 智能家居设备的数据交换, 传感器数据的上传和命令下发, 电力、农业等行业的边缘计算设备
      • CoAP - Constrained Application Protocol - 物联网中广泛使用的轻量级通信协议,CBOR 是默认的编码格式,用于设备之间的状态、命令和数据传输。
      • LwM2M - Lightweight M2M - 基于 CoAP 的设备管理协议,使用 CBOR 传输数据
  • hildjj.github.io/cbor2/playground
    • Playground
  • cbor.me
    • Debugger
    • 数据会发送到服务端
  • Golang -
  • 参考
tagMeaningContentnotes
Major
0unsigned integer N-
1negative integer -1-N-
2byte stringN bytes - base64url - wo pad
3text stringN bytes (UTF-8 text)
4arrayN data items (elements)
5map2N data items (key/ value pairs)
6tag of number N1 data item
7simple/float-
date
1004UTF-8 text stringfull-date stringrfc8943
100days since 1970-01-01Unsigned or negative integerrfc8943

Schema

关联信息

反向链接、本文链接的其他页面和外部资料。

参考资料

GitHub3 条
标准文档5 条
  • RFC 8949datatracker.ietf.org/doc/html/rfc8949
    RFC

    IETF Request for Comments standard document.

  • RFC 8152datatracker.ietf.org/doc/html/rfc8152
    RFC

    IETF Request for Comments standard document.

  • RFC 8392datatracker.ietf.org/doc/html/rfc8392
    RFC

    IETF Request for Comments standard document.

  • RFC 8610datatracker.ietf.org/doc/html/rfc8610
    RFC

    IETF Request for Comments standard document.

  • RFC 8943datatracker.ietf.org/doc/html/rfc8943
    RFC

    IETF Request for Comments standard document.

其他外链5 条
最近更新commit ed3adbf编辑