Skip to content

Commit

Permalink
Use sk-cbor library instead of serde_cbor
Browse files Browse the repository at this point in the history
 - Bump crate version to 0.2.0
 - Move to be no_std; drop use of maplit crate in tests.
 - Change encoding methods to consume `self`.
 - Change encoding methods to be fallible.
  • Loading branch information
daviddrysdale committed Oct 21, 2021
1 parent ef27d65 commit 52b9b12
Show file tree
Hide file tree
Showing 23 changed files with 1,130 additions and 1,184 deletions.
83 changes: 5 additions & 78 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 2 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "coset"
version = "0.1.2"
version = "0.2.0"
authors = ["David Drysdale <[email protected]>"]
edition = "2018"
license = "Apache-2.0"
Expand All @@ -10,9 +10,7 @@ keywords = ["cryptography", "cose"]
categories = ["cryptography"]

[dependencies]
maplit = "^1.0"
serde_cbor = { version = "^0.11.1", features = ["std", "tags"] }
serde = { version = "^1.0.127", features = ["derive"] }
sk-cbor = "^0.1.0"

[dev-dependencies]
hex = "^0.4.2"
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,17 @@

This crate holds a set of Rust types for working with CBOR Object Signing and Encryption (COSE) objects, as defined in
[RFC 8152](https://tools.ietf.org/html/rfc8152). It builds on the core [CBOR](https://tools.ietf.org/html/rfc7049)
parsing functionality from the [`serde_cbor` crate](https://docs.rs/serde_cbor).
parsing functionality from the [`sk-cbor` crate](https://docs.rs/sk-cbor).

See [crate docs](https://google.github.io/coset/rust/coset/index.html), or the [signature
example](examples/signature.rs) 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.

## `no_std` Support

This crate supports `no_std`, but uses the `alloc` crate.

## Working on the Code

Local coding conventions are enforced by the [continuous integration jobs](.github/workflows) and include:
Expand Down
3 changes: 1 addition & 2 deletions examples/signature.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
////////////////////////////////////////////////////////////////////////////////

//! Example program demonstrating signature creation.
use coset::{iana, CborSerializable};

#[derive(Copy, Clone)]
Expand Down Expand Up @@ -62,7 +61,7 @@ fn main() {
"'{}' + '{}' => {}",
String::from_utf8_lossy(pt),
String::from_utf8_lossy(aad),
hex::encode(sign1.to_vec().unwrap())
hex::encode(&sign1_data)
);

// At the receiving end, deserialize the bytes back to a `CoseSign1` object.
Expand Down
85 changes: 7 additions & 78 deletions fuzz/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 52b9b12

Please sign in to comment.