Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add crates badge to README #251

Merged
merged 2 commits into from
Mar 25, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
chore: add crates badge to readme + minor refactor
  • Loading branch information
geonnave committed Mar 20, 2024
commit 3a3a27e745afe27d854ede866f011a0c8c3ee6e5
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# lakers: EDHOC implemented in Rust

[![Build and test](https://github.com/openwsn-berkeley/lakers/actions/workflows/build-and-test.yml/badge.svg)](https://github.com/openwsn-berkeley/lakers/actions/workflows/build-and-test.yml)
![crates.io](https://img.shields.io/crates/v/lakers.svg)

An implementation of [EDHOC](https://datatracker.ietf.org/doc/draft-ietf-lake-edhoc/) in Rust:
- up-to-date with the [latest draft version (23)](https://datatracker.ietf.org/doc/draft-ietf-lake-edhoc/23/)
Expand All @@ -13,6 +14,7 @@ It currently supports authentication mode STAT-STAT and Cipher Suite 2 (AES-CCM-

Here's a quick look at the API for the Initiator role (for the Responder role, and more details, check the examples or the unit tests):
```rust
// perform the handshake
let initiator = EdhocInitiator::new(default_crypto());

let (initiator, message_1) = initiator.prepare_message_1(None, &None)?; // c_i and ead_1 are set to None
Expand All @@ -22,6 +24,13 @@ let valid_cred_r = credential_check_or_fetch(Some(CRED_R), id_cred_r)?; // CRED_
let initiator = initiator.verify_message_2(I, cred_i, valid_cred_r)?; // I is Initiator's private key

let (mut initiator, message_3, i_prk_out) = initiator.prepare_message_3(CredentialTransfer::ByReference, &None)?; // no ead_3

// derive a secret to use with OSCORE
let oscore_secret = initiator.edhoc_exporter(0u8, &[], 16); // label is 0

// update the prk_out key (context taken from draft-ietf-lake-traces)
let context = &[0xa0, 0x11, 0x58, 0xfd, 0xb8, 0x20, 0x89, 0x0c, 0xd6, 0xbe, 0x16, 0x96, 0x02, 0xb8, 0xbc, 0xea];
let prk_out_new = initiator.edhoc_key_update(context);
```

## Installation
Expand Down
10 changes: 4 additions & 6 deletions lib/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -607,14 +607,12 @@ mod test {
assert_eq!(i_oscore_salt, r_oscore_salt);

// test key update with context from draft-ietf-lake-traces
let i_prk_out_new = initiator.edhoc_key_update(&[
let context = &[
0xa0, 0x11, 0x58, 0xfd, 0xb8, 0x20, 0x89, 0x0c, 0xd6, 0xbe, 0x16, 0x96, 0x02, 0xb8,
0xbc, 0xea,
]);
let r_prk_out_new = responder.edhoc_key_update(&[
0xa0, 0x11, 0x58, 0xfd, 0xb8, 0x20, 0x89, 0x0c, 0xd6, 0xbe, 0x16, 0x96, 0x02, 0xb8,
0xbc, 0xea,
]);
];
let i_prk_out_new = initiator.edhoc_key_update(context);
let r_prk_out_new = responder.edhoc_key_update(context);

assert_eq!(i_prk_out_new, r_prk_out_new);
}
Expand Down
Loading