Compare commits

...

12 commits
v0.1 ... main

10 changed files with 53 additions and 17 deletions

1
.github/FUNDING.yml vendored Normal file
View file

@ -0,0 +1 @@
github: [breard-r]

View file

@ -20,11 +20,21 @@ jobs:
- 1.75.0
- 1.76.0
- 1.77.2
- 1.78.0
- 1.79.0
- 1.80.0
- 1.81.0
- 1.82.0
- 1.83.0
- 1.84.1
- 1.85.0
- stable
- beta
- nightly
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
- name: Install Rust ${{ matrix.rust }}
run: rustup toolchain install ${{ matrix.rust }}
- name: Run cargo build
@ -36,6 +46,8 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
- name: Update Rust
run: rustup update stable
- name: Run cargo fmt
@ -45,6 +57,8 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
- name: Update Rust
run: rustup update stable
- name: Run clippy
@ -54,4 +68,6 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
- uses: EmbarkStudios/cargo-deny-action@v1

19
CHANGELOG.md Normal file
View file

@ -0,0 +1,19 @@
[//]: # (Copyright 2024 Rodolphe Bréard <rodolphe@breard.tf>)
[//]: # (Copying and distribution of this file, with or without modification,)
[//]: # (are permitted in any medium without royalty provided the copyright)
[//]: # (notice and this notice are preserved. This file is offered as-is,)
[//]: # (without any warranty.)
# Changelog
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [Unreleased] - ReleaseDate
### Added
- Initial release.

View file

@ -12,7 +12,7 @@ keywords = ["cryptography", "encryption"]
categories = ["cryptography"]
[features]
default = ["aes", "chacha", "ikm-management"]
default = ["aes", "chacha", "ikm-management", "encrypt-at"]
encryption = []
aes = ["encryption", "aes-gcm", "hkdf", "sha2"]
chacha = ["encryption", "chacha20poly1305", "blake3"]
@ -22,8 +22,8 @@ benchmark = ["criterion"]
[dependencies]
base64ct = { version = "1.6.0", default-features = false, features = ["std"] }
getrandom = { version = "0.2.12", default-features = false }
thiserror = { version = "1.0.57", default-features = false }
getrandom = { version = "0.3.0", default-features = false }
thiserror = { version = "2.0.3", default-features = false }
# chacha feature:
# - XChaCha20Poly1305WithBlake3

View file

@ -35,8 +35,8 @@ to your use case and if you are using it correctly.
## Should I use this crate?
Although it may work, some parts are not stabilized yet. Expect breaking change
that may result in the total loss of previously encrypted data.
If you have a use case covered by this crate AND you do not care about using an
experimental crate, then you may use it.
## Why should I use this crate instead of a symmetric encryption function?

View file

@ -93,7 +93,7 @@ allow = [
"BSD-2-Clause",
"BSD-3-Clause",
"MIT",
"Unicode-DFS-2016",
"Unicode-3.0",
]
# The confidence threshold for detecting a license from license text.
# The higher the value, the more closely the license text must be to the

View file

@ -243,7 +243,7 @@ impl InputKeyMaterialList {
) -> Result<IkmId> {
let ikm_len = scheme.get_ikm_size();
let mut content: Vec<u8> = vec![0; ikm_len];
getrandom::getrandom(content.as_mut_slice())?;
getrandom::fill(content.as_mut_slice())?;
self.id_counter += 1;
self.ikm_lst.push(InputKeyMaterial {
id: self.id_counter,
@ -696,7 +696,7 @@ mod encryption {
}
#[test]
#[cfg(feature = "sha")]
#[cfg(feature = "aes")]
fn get_latest_ikm_aes128gcm_sha256() {
let mut lst = InputKeyMaterialList::new();
let _ = lst.add_ikm();

View file

@ -13,7 +13,7 @@ const NONCE_SIZE: usize = 12;
pub(crate) fn aes128gcm_gen_nonce() -> Result<Vec<u8>> {
let mut nonce: [u8; NONCE_SIZE] = [0; NONCE_SIZE];
getrandom::getrandom(&mut nonce)?;
getrandom::fill(&mut nonce)?;
Ok(nonce.to_vec())
}

View file

@ -9,7 +9,7 @@ const NONCE_SIZE: usize = 24;
pub(crate) fn xchacha20poly1305_gen_nonce() -> Result<Vec<u8>> {
let mut nonce: [u8; NONCE_SIZE] = [0; NONCE_SIZE];
getrandom::getrandom(&mut nonce)?;
getrandom::fill(&mut nonce)?;
Ok(nonce.to_vec())
}