Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: bump rsa to 0.9 #21016

Merged
merged 14 commits into from
Oct 30, 2023
Prev Previous commit
Next Next commit
rsa ext/crypto encrypt.rs
  • Loading branch information
littledivy committed Oct 30, 2023
commit b1f690a529469d2d7c6c5ef17803a2b81f224f2e
1 change: 0 additions & 1 deletion ext/crypto/decrypt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ use deno_core::JsBuffer;
use deno_core::ToJsBuffer;
use rsa::pkcs1::DecodeRsaPrivateKey;
use serde::Deserialize;
use sha1::Digest;
use sha1::Sha1;
use sha2::Sha256;
use sha2::Sha384;
Expand Down
27 changes: 12 additions & 15 deletions ext/crypto/encrypt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,7 @@ use deno_core::JsBuffer;
use deno_core::ToJsBuffer;
use rand::rngs::OsRng;
use rsa::pkcs1::DecodeRsaPublicKey;
use rsa::PaddingScheme;
use rsa::PublicKey;
use serde::Deserialize;
use sha1::Digest;
use sha1::Sha1;
use sha2::Sha256;
use sha2::Sha384;
Expand Down Expand Up @@ -119,24 +116,24 @@ fn encrypt_rsa_oaep(
.map_err(|_| operation_error("failed to decode public key"))?;
let mut rng = OsRng;
let padding = match hash {
ShaHash::Sha1 => PaddingScheme::OAEP {
digest: Box::new(Sha1::new()),
mgf_digest: Box::new(Sha1::new()),
ShaHash::Sha1 => rsa::Oaep {
digest: Box::new(Sha1::default()),
mgf_digest: Box::new(Sha1::default()),
label: Some(label),
},
ShaHash::Sha256 => PaddingScheme::OAEP {
digest: Box::new(Sha256::new()),
mgf_digest: Box::new(Sha256::new()),
ShaHash::Sha256 => rsa::Oaep {
digest: Box::new(Sha256::default()),
mgf_digest: Box::new(Sha256::default()),
label: Some(label),
},
ShaHash::Sha384 => PaddingScheme::OAEP {
digest: Box::new(Sha384::new()),
mgf_digest: Box::new(Sha384::new()),
ShaHash::Sha384 => rsa::Oaep {
digest: Box::new(Sha384::default()),
mgf_digest: Box::new(Sha384::default()),
label: Some(label),
},
ShaHash::Sha512 => PaddingScheme::OAEP {
digest: Box::new(Sha512::new()),
mgf_digest: Box::new(Sha512::new()),
ShaHash::Sha512 => rsa::Oaep {
digest: Box::new(Sha512::default()),
mgf_digest: Box::new(Sha512::default()),
label: Some(label),
},
};
Expand Down