| commit | 9f09223a637fea599900adb64eb873adf052aff5 | [log] [tgz] |
|---|---|---|
| author | James Farrell <jamesfarrell@google.com> | Mon Aug 26 20:42:33 2024 +0000 |
| committer | James Farrell <jamesfarrell@google.com> | Mon Aug 26 20:42:33 2024 +0000 |
| tree | af54bbb7011ee0fbc9a17221e49a2599d7287f66 | |
| parent | 9c7bde8f2895fece5a38bc8f9dbcf8b263671199 [diff] |
Migrate 25 crates to monorepo. combine command-fds const-oid coset crc32fast criterion criterion-plot crossbeam-channel crossbeam-deque crossbeam-epoch crossbeam-queue crossbeam-utils darling_core darling_macro dashmap data-encoding der der_derive derive_arbitrary displaydoc document-features downcast-rs drm either enumn Bug: 339424309 Test: treehugger Change-Id: Iad9a7f5d4da46742372af5d74e3370e284b6f631
This crate holds a set of Rust types for working with CBOR Object Signing and Encryption (COSE) objects, as defined in RFC 8152. It builds on the core CBOR parsing functionality from the ciborium crate.
See crate docs, or the signature example for documentation on how to use the code.
This repo is under construction and so details of the API and the code may change without warning.
The std feature of the crate enables an implementation of std::error::Error for CoseError.
no_std SupportThis crate supports no_std (when the std feature is not set, which is the default), but uses the alloc crate.
MSRV is 1.58.
CBOR supports integers in the range:
[-18_446_744_073_709_551_616, -1] ∪ [0, 18_446_744_073_709_551_615]
which is [-264, -1] ∪ [0, 264 - 1].
This does not map onto a single Rust integer type, so different CBOR crates take different approaches.
serde_cbor crate uses a single i128 integer type for all integer values, which means that all CBOR integer values can be expressed, but there are also i128 values that cannot be encoded in CBOR. This also means that data size is larger.ciborium also uses a single i128 integer type internally, but wraps it in its own Integer type and only implements TryFrom (not From) for i128 / u128 conversions so that unrepresentable numbers can be rejected.sk-cbor crate uses distinct types:This crate uses a single type to encompass both positive and negative values, but uses i64 for that type to keep data sizes smaller. This means that:
i64 cover [0, 263 - 1]i64 cover [-263, -1]and so there are large values – both positive and negative – which are not supported by this crate.
Local coding conventions are enforced by the continuous integration jobs and include:
rustfmt using the local rustfmt.toml settings.TODO markers should be of form TODO(#99) and refer to an open GitHub issue.panic!, unwrap, expect) should have a comment on the same line in the form // safe: reason (or /* safe: reason */) to document the reason why panicking is acceptable.This is not an officially supported Google product.