google / coset

A set of Rust types for supporting COSE
Apache License 2.0
28 stars 16 forks source link

COSET

Docs CI Status codecov

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.

Features

The std feature of the crate enables an implementation of std::error::Error for CoseError.

no_std Support

This crate supports no_std (when the std feature is not set, which is the default), but uses the alloc crate.

Minimum Supported Rust Version

MSRV is 1.58.

Integer Ranges

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.

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:

and so there are large values – both positive and negative – which are not supported by this crate.

Working on the Code

Local coding conventions are enforced by the continuous integration jobs and include:

Disclaimer

This is not an officially supported Google product.