Skip to content

Commit c551e7f

Browse files
authored
Merge branch 'km/cose' into km/cose-signatures
2 parents 4d38d5e + ae9a7da commit c551e7f

File tree

15 files changed

+146
-114
lines changed

15 files changed

+146
-114
lines changed

crates/bitwarden-core/src/auth/tde.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ pub(super) fn make_register_tde_keys(
1717
) -> Result<RegisterTdeKeyResponse, EncryptionSettingsError> {
1818
let public_key = AsymmetricPublicCryptoKey::from_der(&STANDARD.decode(org_public_key)?)?;
1919

20-
let user_key = UserKey::new(SymmetricCryptoKey::generate());
20+
let user_key = UserKey::new(SymmetricCryptoKey::generate_aes256_cbc_hmac());
2121
let key_pair = user_key.make_key_pair()?;
2222

2323
let admin_reset = UnauthenticatedSharedKey::encapsulate_key_unsigned(&user_key.0, &public_key)?;

crates/bitwarden-crypto/Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ num-bigint = ">=0.4, <0.5"
4242
num-traits = ">=0.2.15, <0.3"
4343
pbkdf2 = { version = ">=0.12.1, <0.13", default-features = false }
4444
rand = ">=0.8.5, <0.9"
45+
rand_chacha = ">=0.3.1, <0.4.0"
4546
rayon = ">=1.8.1, <2.0"
4647
rsa = ">=0.9.2, <0.10"
4748
schemars = { workspace = true }

crates/bitwarden-crypto/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ secure.
1616
use bitwarden_crypto::{SymmetricCryptoKey, KeyEncryptable, KeyDecryptable, CryptoError};
1717

1818
async fn example() -> Result<(), CryptoError> {
19-
let key = SymmetricCryptoKey::generate();
19+
let key = SymmetricCryptoKey::generate_aes256_cbc_hmac();
2020

2121
let data = "Hello, World!".to_owned();
2222
let encrypted = data.clone().encrypt_with_key(&key)?;

crates/bitwarden-crypto/src/enc_string/asymmetric.rs

+9-11
Original file line numberDiff line numberDiff line change
@@ -263,11 +263,10 @@ XKZBokBGnjFnTnKcs7nv/O8=
263263
#[test]
264264
fn test_enc_string_rsa2048_oaep_sha256_b64() {
265265
let key_pair = AsymmetricCryptoKey::from_pem(RSA_PRIVATE_KEY).unwrap();
266-
let enc_str: &str = "3.BfwZTwBYbU5WQ5X7Vm8yl0hYmHTRdkVACCRZYcqhcjicoaPVDEP03CIRmtnppu0aXOppoQzhw5S2OKTUaqoOGKZg7+PrmVEhjiUFfVAptInBD6XGHZ0Z3u3F+JY1E3xIFebOFiX7KLQ+7D0bJhBEnl8P7phmanKF3Cil5ayDGRpAjAsBHMwlNRKXy05YpYs3/x+V+zjlxVrBU9gYFCpacKUbxT51I8tf21ISqo6H9ZBwqDE2QUPhYJl5op7SJgySdd3YCKnsObXa8fFj2OwxGLAXJAyvF6qZyl08RO/ZYUOOOPlbC7ywXxAISw3qmrwxqpLSBqAm9BYPa/zxBnTHrA==";
266+
let enc_str: &str = "3.SUx5gWrgmAKs/S1BoQrqOmx2Hl5fPVBVHokW17Flvm4TpBnJJRkfoitp7Jc4dfazPYjWGlckJz6X+qe+/AWilS1mxtzS0PmDy7tS5xP0GRlB39dstCd5jDw1wPmTbXiLcQ5VTvzpRAfRMEYVveTsEvVTByvEYAGSn4TnCsUDykyhRbD0YcJ4r1KHLs1b3BCBy2M1Gl5nmwckH08CAXaf8VfuBFStAGRKueovqp4euneQla+4G4fXdVvb8qKPnu0iVuALIE6nUNmeOiA3xN3d+akMxbbGxrQ1Ca4TYWjHVdj9C6abngQHkjKNYQwGUXrYo160hP4LIHn/huK6bZe5dQ==";
267267
let enc_string: UnauthenticatedSharedKey = enc_str.parse().unwrap();
268268

269-
let test_bytes = vec![0u8; 64];
270-
let test_key = SymmetricCryptoKey::try_from(test_bytes).unwrap();
269+
let test_key = SymmetricCryptoKey::generate_seeded_for_unit_tests("test");
271270
assert_eq!(enc_string.enc_type(), 3);
272271

273272
let res = enc_string.decapsulate_key_unsigned(&key_pair).unwrap();
@@ -277,29 +276,28 @@ XKZBokBGnjFnTnKcs7nv/O8=
277276
#[test]
278277
fn test_enc_string_rsa2048_oaep_sha1_b64() {
279278
let private_key = AsymmetricCryptoKey::from_pem(RSA_PRIVATE_KEY).unwrap();
280-
let enc_str: &str = "4.KhZmkc7f2WYuZGm/xlKZOK4c5JSwd9JtJvmyk0R+ZCqbRnZi5XNJaqnMiJjiqeLztE97bHRGWyDPvhyIisr7jLi35vL/Znpg3QzSMEDNI7aAM2FwJbCzdUrFDa/h08edv816AL1hAOqtGmjpfRL1j+47hlAiF3/srFCeePHkj0+CmHpHN13BN1XkLKk58mETKh8ky/ZUW2s4NjZaZ/Wxh6I9sv28L+u1hekKxDOdNKBnmqsh8WRBOtmZm1ZM9WI6aPA5tXgp30vxWrc1AsZ5Ts0aVkm8UzPTWuU9d/O9ICAQkr1hX58qO6M5geP+NvaG3UGymw0zp6Hdgz239XYpKg==";
279+
let enc_str: &str = "4.DMD1D5r6BsDDd7C/FE1eZbMCKrmryvAsCKj6+bO54gJNUxisOI7SDcpPLRXf+JdhqY15pT+wimQ5cD9C+6OQ6s71LFQHewXPU29l9Pa1JxGeiKqp37KLYf+1IS6UB2K3ANN35C52ZUHh2TlzIS5RuntxnpCw7APbcfpcnmIdLPJBtuj/xbFd6eBwnI3GSe5qdS6/Ixdd0dgsZcpz3gHJBKmIlSo0YN60SweDq3kTJwox9xSqdCueIDg5U4khc7RhjYx8b33HXaNJj3DwgIH8iLj+lqpDekogr630OhHG3XRpvl4QzYO45bmHb8wAh67Dj70nsZcVg6bAEFHdSFohww==";
281280
let enc_string: UnauthenticatedSharedKey = enc_str.parse().unwrap();
282281

283-
let test_bytes = vec![0u8; 64];
284-
let test_bytes = SymmetricCryptoKey::try_from(test_bytes).unwrap();
282+
let test_key = SymmetricCryptoKey::generate_seeded_for_unit_tests("test");
285283
assert_eq!(enc_string.enc_type(), 4);
286284

287285
let res = enc_string.decapsulate_key_unsigned(&private_key).unwrap();
288-
assert_eq!(res, test_bytes);
286+
assert_eq!(res, test_key);
289287
}
290288

291289
#[test]
292290
fn test_enc_string_rsa2048_oaep_sha1_hmac_sha256_b64() {
293291
let private_key = AsymmetricCryptoKey::from_pem(RSA_PRIVATE_KEY).unwrap();
294-
let enc_str: &str = "6.KhZmkc7f2WYuZGm/xlKZOK4c5JSwd9JtJvmyk0R+ZCqbRnZi5XNJaqnMiJjiqeLztE97bHRGWyDPvhyIisr7jLi35vL/Znpg3QzSMEDNI7aAM2FwJbCzdUrFDa/h08edv816AL1hAOqtGmjpfRL1j+47hlAiF3/srFCeePHkj0+CmHpHN13BN1XkLKk58mETKh8ky/ZUW2s4NjZaZ/Wxh6I9sv28L+u1hekKxDOdNKBnmqsh8WRBOtmZm1ZM9WI6aPA5tXgp30vxWrc1AsZ5Ts0aVkm8UzPTWuU9d/O9ICAQkr1hX58qO6M5geP+NvaG3UGymw0zp6Hdgz239XYpKg==|AA==";
292+
let enc_str: &str = "6.DMD1D5r6BsDDd7C/FE1eZbMCKrmryvAsCKj6+bO54gJNUxisOI7SDcpPLRXf+JdhqY15pT+wimQ5cD9C+6OQ6s71LFQHewXPU29l9Pa1JxGeiKqp37KLYf+1IS6UB2K3ANN35C52ZUHh2TlzIS5RuntxnpCw7APbcfpcnmIdLPJBtuj/xbFd6eBwnI3GSe5qdS6/Ixdd0dgsZcpz3gHJBKmIlSo0YN60SweDq3kTJwox9xSqdCueIDg5U4khc7RhjYx8b33HXaNJj3DwgIH8iLj+lqpDekogr630OhHG3XRpvl4QzYO45bmHb8wAh67Dj70nsZcVg6bAEFHdSFohww==|AA==";
295293
let enc_string: UnauthenticatedSharedKey = enc_str.parse().unwrap();
296294

297-
let test_bytes = vec![0u8; 64];
298-
let test_key = SymmetricCryptoKey::try_from(test_bytes).unwrap();
295+
let test_key: SymmetricCryptoKey =
296+
SymmetricCryptoKey::generate_seeded_for_unit_tests("test");
299297
assert_eq!(enc_string.enc_type(), 6);
300298

301299
let res = enc_string.decapsulate_key_unsigned(&private_key).unwrap();
302-
assert_eq!(res, test_key);
300+
assert_eq!(res.to_base64(), test_key.to_base64());
303301
}
304302

305303
#[test]

crates/bitwarden-crypto/src/keys/asymmetric_crypto_key.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ DnqOsltgPomWZ7xVfMkm9niL2OA=
216216
let private_key = AsymmetricCryptoKey::from_der(&private_key).unwrap();
217217
let public_key = AsymmetricPublicCryptoKey::from_der(&public_key).unwrap();
218218

219-
let raw_key = SymmetricCryptoKey::generate();
219+
let raw_key = SymmetricCryptoKey::generate_aes256_cbc_hmac();
220220
let encrypted =
221221
UnauthenticatedSharedKey::encapsulate_key_unsigned(&raw_key, &public_key).unwrap();
222222
let decrypted = encrypted.decapsulate_key_unsigned(&private_key).unwrap();

crates/bitwarden-crypto/src/keys/device_key.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ impl DeviceKey {
3030
/// from EncSettings.
3131
pub fn trust_device(user_key: &SymmetricCryptoKey) -> Result<TrustDeviceResponse> {
3232
let mut rng = rand::thread_rng();
33-
let device_key = DeviceKey(SymmetricCryptoKey::generate());
33+
let device_key = DeviceKey(SymmetricCryptoKey::generate_aes256_cbc_hmac());
3434

3535
let device_private_key = AsymmetricCryptoKey::generate(&mut rng);
3636

crates/bitwarden-crypto/src/keys/master_key.rs

+8-2
Original file line numberDiff line numberDiff line change
@@ -160,8 +160,14 @@ pub(super) fn decrypt_user_key(
160160
}
161161

162162
/// Generate a new random user key and encrypt it with the master key.
163-
fn make_user_key(rng: impl rand::RngCore, master_key: &MasterKey) -> Result<(UserKey, EncString)> {
164-
let user_key = SymmetricCryptoKey::generate_internal(rng, false);
163+
///
164+
/// WARNING: This function should only be used with a proper cryptographic random number generator.
165+
/// If you do not have a good reason for using this, use [MasterKey::make_user_key] instead.
166+
fn make_user_key(
167+
mut rng: impl rand::RngCore,
168+
master_key: &MasterKey,
169+
) -> Result<(UserKey, EncString)> {
170+
let user_key = SymmetricCryptoKey::generate_aes256_cbc_hmac_internal(&mut rng);
165171
let protected = master_key.encrypt_user_key(&user_key)?;
166172
Ok((UserKey::new(user_key), protected))
167173
}

crates/bitwarden-crypto/src/keys/symmetric_crypto_key.rs

+66-47
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,17 @@ use aes::cipher::typenum::U32;
44
use base64::{engine::general_purpose::STANDARD, Engine};
55
use coset::{iana, CborSerializable, Label, RegisteredLabelWithPrivate};
66
use generic_array::GenericArray;
7-
use rand::Rng;
7+
use rand::{Rng, SeedableRng};
8+
use rand_chacha::ChaChaRng;
9+
use sha2::Digest;
810
use subtle::{Choice, ConstantTimeEq};
911
use zeroize::{Zeroize, ZeroizeOnDrop};
1012

1113
use super::{key_encryptable::CryptoKey, key_id::KeyId};
1214
use crate::{cose, CryptoError};
1315

14-
/// Aes256CbcKey is a symmetric encryption key, consisting of one 256-bit key,
15-
/// used to decrypt legacy type 0 encstrings. The data is not autenticated
16+
/// [Aes256CbcKey] is a symmetric encryption key, consisting of one 256-bit key,
17+
/// used to decrypt legacy type 0 enc strings. The data is not authenticated
1618
/// so this should be used with caution, and removed where possible.
1719
#[derive(ZeroizeOnDrop, Clone)]
1820
pub struct Aes256CbcKey {
@@ -32,7 +34,7 @@ impl PartialEq for Aes256CbcKey {
3234
}
3335
}
3436

35-
/// Aes256CbcHmacKey is a symmetric encryption key consisting
37+
/// [Aes256CbcHmacKey] is a symmetric encryption key consisting
3638
/// of two 256-bit keys, one for encryption and one for MAC
3739
#[derive(ZeroizeOnDrop, Clone)]
3840
pub struct Aes256CbcHmacKey {
@@ -88,49 +90,46 @@ impl SymmetricCryptoKey {
8890
// enc type 2 old static format
8991
const AES256_CBC_HMAC_KEY_LEN: usize = 64;
9092

93+
/// Generate a new random AES256_CBC [SymmetricCryptoKey]
94+
///
95+
/// WARNING: This function should only be used with a proper cryptographic RNG. If you do not
96+
/// have a good reason for using this function, use
97+
/// [SymmetricCryptoKey::generate_aes256_cbc_hmac] instead.
98+
pub(crate) fn generate_aes256_cbc_hmac_internal(rng: &mut impl Rng) -> Self {
99+
let mut enc_key = Box::pin(GenericArray::<u8, U32>::default());
100+
let mut mac_key = Box::pin(GenericArray::<u8, U32>::default());
101+
102+
rng.fill(enc_key.as_mut_slice());
103+
rng.fill(mac_key.as_mut_slice());
104+
105+
SymmetricCryptoKey::Aes256CbcHmacKey(Aes256CbcHmacKey { enc_key, mac_key })
106+
}
107+
91108
/**
92109
* Generate a new random AES256_CBC_HMAC [SymmetricCryptoKey]
93110
*/
94-
pub fn generate() -> Self {
111+
pub fn generate_aes256_cbc_hmac() -> Self {
95112
let mut rng = rand::thread_rng();
96-
Self::generate_internal(&mut rng, false)
113+
Self::generate_aes256_cbc_hmac_internal(&mut rng)
97114
}
98115

99116
/**
100117
* Generate a new random XChaCha20Poly1305 [SymmetricCryptoKey]
101118
*/
102119
pub fn generate_xchacha20() -> Self {
103120
let mut rng = rand::thread_rng();
104-
Self::generate_internal(&mut rng, true)
105-
}
106-
107-
/// Generate a new random [SymmetricCryptoKey]
108-
/// @param rng: A random number generator
109-
/// @param xchacha20: If true, generate an XChaCha20Poly1305 key, otherwise generate an
110-
/// AES256_CBC_HMAC key
111-
pub(crate) fn generate_internal(mut rng: impl rand::RngCore, xchacha20: bool) -> Self {
112-
if !xchacha20 {
113-
let mut enc_key = Box::pin(GenericArray::<u8, U32>::default());
114-
let mut mac_key = Box::pin(GenericArray::<u8, U32>::default());
115-
116-
rng.fill(enc_key.as_mut_slice());
117-
rng.fill(mac_key.as_mut_slice());
118-
119-
SymmetricCryptoKey::Aes256CbcHmacKey(Aes256CbcHmacKey { enc_key, mac_key })
120-
} else {
121-
let mut enc_key = Box::pin(GenericArray::<u8, U32>::default());
122-
rng.fill(enc_key.as_mut_slice());
123-
SymmetricCryptoKey::XChaCha20Poly1305Key(XChaCha20Poly1305Key {
124-
enc_key,
125-
key_id: *KeyId::generate().as_bytes(),
126-
})
127-
}
121+
let mut enc_key = Box::pin(GenericArray::<u8, U32>::default());
122+
rng.fill(enc_key.as_mut_slice());
123+
SymmetricCryptoKey::XChaCha20Poly1305Key(XChaCha20Poly1305Key {
124+
enc_key,
125+
key_id: *KeyId::generate().as_bytes(),
126+
})
128127
}
129128

130129
/// Encodes the key to a byte array representation, that is separated by size.
131-
/// `SymmetricCryptoKey::Aes256CbcHmacKey` and `SymmetricCryptoKey::Aes256CbcKey` are
132-
/// encoded as 64 and 32 bytes respectively. `SymmetricCryptoKey::XChaCha20Poly1305Key`
133-
/// is encoded as at least 65 bytes, by using padding defined in `pad_key`.
130+
/// [SymmetricCryptoKey::Aes256CbcHmacKey] and [SymmetricCryptoKey::Aes256CbcKey] are
131+
/// encoded as 64 and 32 bytes respectively. [SymmetricCryptoKey::XChaCha20Poly1305Key]
132+
/// is encoded as at least 65 bytes, using padding.
134133
///
135134
/// This can be used for storage and transmission in the old byte array format.
136135
/// When the wrapping key is a COSE key, and the wrapped key is a COSE key, then this should
@@ -148,6 +147,20 @@ impl SymmetricCryptoKey {
148147
}
149148
}
150149

150+
/// Generate a new random [SymmetricCryptoKey] for unit tests. Note: DO NOT USE THIS
151+
/// IN PRODUCTION CODE.
152+
pub fn generate_seeded_for_unit_tests(seed: &str) -> Self {
153+
// Keep this separate from the other generate function to not break test vectors.
154+
let mut seeded_rng = ChaChaRng::from_seed(sha2::Sha256::digest(seed.as_bytes()).into());
155+
let mut enc_key = Box::pin(GenericArray::<u8, U32>::default());
156+
let mut mac_key = Box::pin(GenericArray::<u8, U32>::default());
157+
158+
seeded_rng.fill(enc_key.as_mut_slice());
159+
seeded_rng.fill(mac_key.as_mut_slice());
160+
161+
SymmetricCryptoKey::Aes256CbcHmacKey(Aes256CbcHmacKey { enc_key, mac_key })
162+
}
163+
151164
pub(crate) fn to_encoded_raw(&self) -> Vec<u8> {
152165
match self {
153166
SymmetricCryptoKey::Aes256CbcKey(key) => key.enc_key.to_vec(),
@@ -299,6 +312,12 @@ fn parse_cose_key(cose_key: &coset::CoseKey) -> Result<SymmetricCryptoKey, Crypt
299312
}
300313
}
301314

315+
impl From<Aes256CbcHmacKey> for SymmetricCryptoKey {
316+
fn from(key: Aes256CbcHmacKey) -> Self {
317+
SymmetricCryptoKey::Aes256CbcHmacKey(key)
318+
}
319+
}
320+
302321
impl CryptoKey for SymmetricCryptoKey {}
303322

304323
// We manually implement these to make sure we don't print any sensitive data
@@ -312,29 +331,29 @@ impl std::fmt::Debug for SymmetricCryptoKey {
312331
/// The last N bytes of the padded bytes all have the value N.
313332
/// For example, padded to size 4, the value 0,0 becomes 0,0,2,2.
314333
///
315-
/// Keys that have the type `SymmetricCryptoKey::XChaCha20Poly1305Key` must be distinguishable
316-
/// from `SymmetricCryptoKey::Aes256CbcHmacKey` keys, when both are encoded as byte arrays
334+
/// Keys that have the type [SymmetricCryptoKey::XChaCha20Poly1305Key] must be distinguishable
335+
/// from [SymmetricCryptoKey::Aes256CbcHmacKey] keys, when both are encoded as byte arrays
317336
/// with no additional content format included in the encoding message. For this reason, the
318337
/// padding is used to make sure that the byte representation uniquely separates the keys by
319-
/// size of the byte array. The previous key types `SymmetricCryptoKey::Aes256CbcHmacKey` and
320-
/// `SymmetricCryptoKey::Aes256CbcKey` are 64 and 32 bytes long respectively.
338+
/// size of the byte array. The previous key types [SymmetricCryptoKey::Aes256CbcHmacKey] and
339+
/// [SymmetricCryptoKey::Aes256CbcKey] are 64 and 32 bytes long respectively.
321340
fn pad_key(key_bytes: &mut Vec<u8>, min_length: usize) {
322341
// at least 1 byte of padding is required
323342
let pad_bytes = min_length.saturating_sub(key_bytes.len()).max(1);
324343
let padded_length = max(min_length, key_bytes.len() + 1);
325344
key_bytes.resize(padded_length, pad_bytes as u8);
326345
}
327346

328-
/// Unpad a key that is padded using the PKCS7-like padding defined by `pad_key`.
347+
/// Unpad a key that is padded using the PKCS7-like padding defined by [pad_key].
329348
/// The last N bytes of the padded bytes all have the value N.
330349
/// For example, padded to size 4, the value 0,0 becomes 0,0,2,2.
331350
///
332-
/// Keys that have the type `SymmetricCryptoKey::XChaCha20Poly1305Key` must be distinguishable
333-
/// from `SymmetricCryptoKey::Aes256CbcHmacKey` keys, when both are encoded as byte arrays
351+
/// Keys that have the type [SymmetricCryptoKey::XChaCha20Poly1305Key] must be distinguishable
352+
/// from [SymmetricCryptoKey::Aes256CbcHmacKey] keys, when both are encoded as byte arrays
334353
/// with no additional content format included in the encoding message. For this reason, the
335354
/// padding is used to make sure that the byte representation uniquely separates the keys by
336-
/// size of the byte array the previous key types `SymmetricCryptoKey::Aes256CbcHmacKey` and
337-
/// `SymmetricCryptoKey::Aes256CbcKey` are 64 and 32 bytes long respectively.
355+
/// size of the byte array the previous key types [SymmetricCryptoKey::Aes256CbcHmacKey] and
356+
/// [SymmetricCryptoKey::Aes256CbcKey] are 64 and 32 bytes long respectively.
338357
fn unpad_key(key_bytes: &[u8]) -> &[u8] {
339358
// this unwrap is safe, the input is always at least 1 byte long
340359
#[allow(clippy::unwrap_used)]
@@ -373,7 +392,7 @@ mod tests {
373392

374393
#[test]
375394
fn test_encode_decode_old_symmetric_crypto_key() {
376-
let key = SymmetricCryptoKey::generate_internal(rand::thread_rng(), false);
395+
let key = SymmetricCryptoKey::generate_aes256_cbc_hmac();
377396
let encoded = key.to_encoded();
378397
let decoded = SymmetricCryptoKey::try_from(encoded).unwrap();
379398
assert_eq!(key, decoded);
@@ -391,10 +410,10 @@ mod tests {
391410

392411
#[test]
393412
fn test_encode_xchacha20_poly1305_key() {
394-
let key = SymmetricCryptoKey::generate_internal(rand::thread_rng(), true);
395-
let key_vec = key.to_encoded();
396-
let key_vec_utf8_lossy = String::from_utf8_lossy(&key_vec);
397-
println!("key_vec: {:?}", key_vec_utf8_lossy);
413+
let key = SymmetricCryptoKey::generate_xchacha20();
414+
let encoded = key.to_encoded();
415+
let decoded = SymmetricCryptoKey::try_from(encoded).unwrap();
416+
assert_eq!(key, decoded);
398417
}
399418

400419
#[test]

crates/bitwarden-crypto/src/store/backend/implementation/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ mod tests {
1717
fn test_creates_a_valid_store() {
1818
let mut store = create_store::<TestSymmKey>();
1919

20-
let key = SymmetricCryptoKey::generate();
20+
let key = SymmetricCryptoKey::generate_aes256_cbc_hmac();
2121
store.upsert(TestSymmKey::A(0), key.clone());
2222

2323
assert_eq!(

0 commit comments

Comments
 (0)