Skip to content

Commit d10d599

Browse files
authored
Merge branch 'main' into km/tracing
2 parents 0f2d0f1 + 7f09fd2 commit d10d599

File tree

4 files changed

+13
-6
lines changed

4 files changed

+13
-6
lines changed

Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,18 +60,21 @@ futures = ">=0.3.31, <0.4"
6060
js-sys = { version = ">=0.3.72, <0.4" }
6161
proc-macro2 = ">=1.0.89, <2"
6262
quote = ">=1.0.37, <2"
63+
rand = ">=0.8.5, <0.9"
6364
reqwest = { version = ">=0.12.5, <0.13", features = [
6465
"json",
6566
"multipart",
6667
"http2",
6768
], default-features = false }
69+
rsa = ">=0.9.2, <0.10"
6870
schemars = { version = ">=1.0.0, <2.0", features = ["uuid1", "chrono04"] }
6971
serde = { version = ">=1.0, <2.0", features = ["derive"] }
7072
serde_bytes = { version = ">=0.11.17, <0.12.0" }
7173
serde_json = ">=1.0.96, <2.0"
7274
serde_qs = ">=0.12.0, <0.16"
7375
serde_repr = ">=0.1.12, <0.2"
7476
serde-wasm-bindgen = ">=0.6.0, <0.7"
77+
sha1 = ">=0.10.5, <0.11"
7578
subtle = ">=2.5.0, <3.0"
7679
syn = ">=2.0.87, <3"
7780
thiserror = ">=1.0.40, <3"

crates/bitwarden-crypto/Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,15 +45,15 @@ hmac = ">=0.12.1, <0.13"
4545
num-bigint = ">=0.4, <0.5"
4646
num-traits = ">=0.2.15, <0.3"
4747
pbkdf2 = { version = ">=0.12.1, <0.13", default-features = false }
48-
rand = ">=0.8.5, <0.9"
48+
rand = { workspace = true }
4949
rand_chacha = ">=0.3.1, <0.4.0"
5050
rayon = ">=1.8.1, <2.0"
51-
rsa = ">=0.9.2, <0.10"
51+
rsa = { workspace = true }
5252
schemars = { workspace = true }
5353
serde = { workspace = true }
5454
serde_bytes = { workspace = true }
5555
serde_repr.workspace = true
56-
sha1 = ">=0.10.5, <0.11"
56+
sha1 = { workspace = true }
5757
sha2 = ">=0.10.6, <0.11"
5858
subtle = { workspace = true }
5959
thiserror = { workspace = true }

crates/bitwarden-wasm-internal/Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,10 @@ bitwarden-state = { workspace = true, features = ["wasm"] }
3333
bitwarden-threading = { workspace = true }
3434
bitwarden-vault = { workspace = true, features = ["wasm"] }
3535
console_error_panic_hook = "0.1.7"
36-
rand = ">=0.8.5, <0.9"
37-
rsa = ">=0.9.2, <0.10"
36+
rand = { workspace = true }
37+
rsa = { workspace = true }
3838
serde = { workspace = true }
39-
sha1 = ">=0.10.5, <0.11"
39+
sha1 = { workspace = true }
4040
tracing = { workspace = true }
4141
tracing-subscriber = { workspace = true }
4242
tracing-web = { version = "0.1.3" }

crates/bitwarden-wasm-internal/src/pure_crypto.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -326,6 +326,7 @@ impl PureCrypto {
326326

327327
/// Given a decrypted private RSA key PKCS8 DER this
328328
/// returns the corresponding public RSA key in DER format.
329+
/// HAZMAT WARNING: Do not use outside of implementing cryptofunctionservice
329330
pub fn rsa_extract_public_key(private_key: Vec<u8>) -> Result<Vec<u8>, RsaError> {
330331
let private_key = AsymmetricCryptoKey::from_der(&Pkcs8PrivateKeyBytes::from(private_key))
331332
.map_err(|_| RsaError::KeyParse)?;
@@ -337,6 +338,7 @@ impl PureCrypto {
337338
}
338339

339340
/// Generates a new RSA key pair and returns the private key
341+
/// HAZMAT WARNING: Do not use outside of implementing cryptofunctionservice
340342
pub fn rsa_generate_keypair() -> Result<Vec<u8>, RsaError> {
341343
let private_key = AsymmetricCryptoKey::make(PublicKeyEncryptionAlgorithm::RsaOaepSha1);
342344
Ok(private_key
@@ -346,6 +348,7 @@ impl PureCrypto {
346348
}
347349

348350
/// Decrypts data using RSAES-OAEP with SHA-1
351+
/// HAZMAT WARNING: Do not use outside of implementing cryptofunctionservice
349352
pub fn rsa_decrypt_data(
350353
encrypted_data: Vec<u8>,
351354
private_key: Vec<u8>,
@@ -359,6 +362,7 @@ impl PureCrypto {
359362
}
360363

361364
/// Encrypts data using RSAES-OAEP with SHA-1
365+
/// HAZMAT WARNING: Do not use outside of implementing cryptofunctionservice
362366
pub fn rsa_encrypt_data(plain_data: Vec<u8>, public_key: Vec<u8>) -> Result<Vec<u8>, RsaError> {
363367
let public_key = RsaPublicKey::from_public_key_der(public_key.as_slice())
364368
.map_err(|_| RsaError::KeyParse)?;

0 commit comments

Comments
 (0)