-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: Merge branch 'release/v9.3.0'
- Loading branch information
Showing
51 changed files
with
1,381 additions
and
176 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,10 @@ | ||
[package] | ||
name = "cosmian_crypto_core" | ||
version = "9.2.1" | ||
version = "9.3.0" | ||
authors = [ | ||
"Bruno Grieder <[email protected]>", | ||
"Théophile BRÉZOT <[email protected]>", | ||
"Bruno GRIEDER <[email protected]>", | ||
"Théophile BRÉZOT <[email protected]>", | ||
"Emmanuel COSTE <[email protected]>", | ||
] | ||
categories = ["cryptography", "security"] | ||
edition = "2021" | ||
|
@@ -24,19 +25,21 @@ certificate = ["curve25519", "x509-cert", "uuid", "pkcs8"] | |
chacha = ["aead", "chacha20poly1305", "chacha20"] | ||
curve25519 = ["curve25519-dalek", "ed25519-dalek", "signature", "sha2"] | ||
default = [ | ||
"aes", | ||
"chacha", | ||
"certificate", | ||
"ecies", | ||
"curve25519", | ||
"certificate", | ||
"nist_curves", | ||
"ser", | ||
"blake", | ||
"sha3", | ||
"rfc5649", | ||
"aes", | ||
"chacha", | ||
"certificate", | ||
"ecies", | ||
"curve25519", | ||
"certificate", | ||
"nist_curves", | ||
"rsa", | ||
"ser", | ||
"blake", | ||
"sha3", | ||
"rfc5649", | ||
] | ||
ecies = ["aead", "crypto_box"] | ||
rsa = ["digest", "dep:rsa", "sha1", "sha2", "dep:sha3", "pkcs8", "rfc5649"] | ||
nist_curves = ["p384", "p256", "p224", "p192", "elliptic-curve", "pkcs8"] | ||
rfc5649 = ["aes", "chacha"] | ||
ser = ["leb128"] | ||
|
@@ -50,22 +53,45 @@ chacha20 = { version = "0.9", optional = true } | |
chacha20poly1305 = { version = "0.10", optional = true } | ||
crypto_box = { version = "0.9.1", features = ["seal"], optional = true } | ||
curve25519-dalek = { version = "4.1.0", optional = true } | ||
ed25519-dalek = { version = "2.0.0", optional = true, features = ["default", "hazmat"] } | ||
elliptic-curve = { version = "0.13.5", default-features = false, features = ["hazmat", "sec1", "pkcs8", "ecdh"], optional = true } | ||
digest = { version = "0.10", optional = true } | ||
ed25519-dalek = { version = "2.0.0", optional = true, features = [ | ||
"default", | ||
"hazmat", | ||
] } | ||
elliptic-curve = { version = "0.13.5", default-features = false, features = [ | ||
"hazmat", | ||
"sec1", | ||
"pkcs8", | ||
"ecdh", | ||
], optional = true } | ||
getrandom = { version = "0.2", features = ["js"] } # needed to compile into WASM | ||
leb128 = { version = "0.2", optional = true } | ||
p192 = { version = "0.13", optional = true } | ||
p224 = { version = "0.13", optional = true } | ||
p256 = { version = "0.13", optional = true } | ||
p384 = { version = "0.13", optional = true } | ||
pkcs8 = { version = "0.10", features = ["encryption", "std", "alloc", "pem"], optional = true } | ||
pkcs8 = { version = "0.10", features = [ | ||
"encryption", | ||
"std", | ||
"alloc", | ||
"pem", | ||
], optional = true } | ||
rand_chacha = "0.3" | ||
rand_core = { version = "0.6.4", features = ["getrandom"] } | ||
rsa = { version = "0.9", optional = true } | ||
sha1 = { version = "0.10", optional = true } | ||
sha2 = { version = "0.10", optional = true } | ||
sha3 = { version = "0.10", optional = true } | ||
signature = { version = "2.1", optional = true } | ||
tiny-keccak = { version = "2.0.2", features = ["shake"], optional = true } | ||
uuid = { version = "1.4", features = ["v4"], optional = true } | ||
x509-cert = { version = "0.2.4", features = ["pem", "std", "builder", "arbitrary", "hazmat"], optional = true } | ||
x509-cert = { version = "0.2.4", features = [ | ||
"pem", | ||
"std", | ||
"builder", | ||
"arbitrary", | ||
"hazmat", | ||
], optional = true } | ||
zeroize = { version = "1.6", features = ["zeroize_derive"] } | ||
|
||
[dev-dependencies] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
#[cfg(feature = "rsa")] | ||
pub fn rsa_key_wrapping() { | ||
use cosmian_crypto_core::{ | ||
reexport::rand_core::{RngCore, SeedableRng}, | ||
CsRng, RsaKeyLength, RsaKeyWrappingAlgorithm, RsaPrivateKey, | ||
}; | ||
use zeroize::Zeroizing; | ||
|
||
let mut rng = CsRng::from_entropy(); | ||
println!("... Generating a 3072 bit RSA key ..."); | ||
let rsa_private_key = RsaPrivateKey::new(&mut rng, RsaKeyLength::Modulus3072).unwrap(); | ||
|
||
let mut key_to_wrap = [0_u8; 32]; | ||
rng.fill_bytes(&mut key_to_wrap); | ||
|
||
let mut key_to_wrap = [0_u8; 189]; | ||
rng.fill_bytes(&mut key_to_wrap); | ||
let key_to_wrap = Zeroizing::from(key_to_wrap.to_vec()); | ||
|
||
let rsa_public_key = rsa_private_key.public_key(); | ||
|
||
print!("Key wrapping with PKCS#11 CKM_RSA_AES_KEY_WRAP SHA-256 AES 256 ..."); | ||
let wrapped_key = rsa_public_key | ||
.wrap_key( | ||
&mut rng, | ||
RsaKeyWrappingAlgorithm::Aes256Sha256, | ||
&key_to_wrap, | ||
) | ||
.unwrap(); | ||
|
||
print!("unwrapping ...: "); | ||
let unwrapped_key = rsa_private_key | ||
.unwrap_key(RsaKeyWrappingAlgorithm::Aes256Sha256, &wrapped_key) | ||
.unwrap(); | ||
|
||
assert_eq!(unwrapped_key, key_to_wrap); | ||
println!("OK"); | ||
} |
Oops, something went wrong.