Skip to content

Commit 7f09fd2

Browse files
authored
Resolve follow-up comments (#595)
## 🎟️ Tracking <!-- Paste the link to the Jira or GitHub issue or otherwise describe / point to where this change is coming from. --> ## 📔 Objective <!-- Describe what the purpose of this PR is, for example what bug you're fixing or new feature you're adding. --> Resolve: #592 (review) ## 🚨 Breaking Changes <!-- Does this PR introduce any breaking changes? If so, please describe the impact and migration path for clients. If you're unsure, the automated TypeScript compatibility check will run when you open/update this PR and provide feedback. For breaking changes: 1. Describe what changed in the client interface 2. Explain why the change was necessary 3. Provide migration steps for client developers 4. Link to any paired client PRs if needed Otherwise, you can remove this section. --> ## ⏰ Reminders before review - Contributor guidelines followed - All formatters and local linters executed and passed - Written new unit and / or integration tests where applicable - Protected functional changes with optionality (feature flags) - Used internationalization (i18n) for all UI strings - CI builds passed - Communicated to DevOps any deployment requirements - Updated any necessary documentation (Confluence, contributing docs) or informed the documentation team ## 🦮 Reviewer guidelines <!-- Suggested interactions but feel free to use (or not) as you desire! --> - 👍 (`:+1:`) or similar for great changes - 📝 (`:memo:`) or ℹ️ (`:information_source:`) for notes or general info - ❓ (`:question:`) for questions - 🤔 (`:thinking:`) or 💭 (`:thought_balloon:`) for more open inquiry that's not quite a confirmed issue and could potentially benefit from discussion - 🎨 (`:art:`) for suggestions / improvements - ❌ (`:x:`) or ⚠️ (`:warning:`) for more significant problems or concerns needing attention - 🌱 (`:seedling:`) or ♻️ (`:recycle:`) for future improvements or indications of technical debt - ⛏ (`:pick:`) for minor or nitpick changes
1 parent 59f40d4 commit 7f09fd2

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)