Skip to content

Commit

Permalink
chore(rust)(deps): update rsa requirement from 0.7 to 0.8 in /wnfs (#168
Browse files Browse the repository at this point in the history
)

* chore(rust)(deps): update rsa requirement from 0.7 to 0.8 in /wnfs

Updates the requirements on [rsa](https://github.com/RustCrypto/RSA) to permit the latest version.
- [Release notes](https://github.com/RustCrypto/RSA/releases)
- [Changelog](https://github.com/RustCrypto/RSA/blob/master/CHANGELOG.md)
- [Commits](RustCrypto/RSA@v0.7.0...v0.8.1)

---
updated-dependencies:
- dependency-name: rsa
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <[email protected]>

* fix: Adjust to rsa 0.8 API

* refactor: merge imports

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Philipp Krüger <[email protected]>
  • Loading branch information
dependabot[bot] and matheus23 authored Mar 23, 2023
1 parent 700c09f commit 129c538
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion wnfs/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ async-std = { version = "1.11", features = ["attributes"] }
env_logger = "0.10"
proptest = "1.1"
rand = "0.8"
rsa = "0.7"
rsa = "0.8"
sha2 = "0.10"
test-log = "0.2"
test-strategy = "0.3"
Expand Down
6 changes: 3 additions & 3 deletions wnfs/src/private/keys/exchange.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use anyhow::anyhow;
use anyhow::Result;
use async_trait::async_trait;
#[cfg(test)]
use rsa::{BigUint, PaddingScheme, PublicKey as PublicKeyTrait, PublicKeyParts};
use rsa::{BigUint, Oaep, PublicKey as PublicKeyTrait, PublicKeyParts};
#[cfg(test)]
use sha2::Sha256;

Expand Down Expand Up @@ -90,7 +90,7 @@ impl RsaPrivateKey {
#[async_trait(?Send)]
impl ExchangeKey for RsaPublicKey {
async fn encrypt(&self, data: &[u8]) -> Result<Vec<u8>> {
let padding = PaddingScheme::new_oaep::<Sha256>();
let padding = Oaep::new::<Sha256>();
self.0
.encrypt(&mut rand::thread_rng(), padding, data)
.map_err(|e| anyhow!(RsaError::EncryptionFailed(anyhow!(e))))
Expand All @@ -110,7 +110,7 @@ impl ExchangeKey for RsaPublicKey {
#[async_trait(?Send)]
impl PrivateKey for RsaPrivateKey {
async fn decrypt(&self, ciphertext: &[u8]) -> Result<Vec<u8>> {
let padding = PaddingScheme::new_oaep::<Sha256>();
let padding = Oaep::new::<Sha256>();
self.0
.decrypt(padding, ciphertext)
.map_err(|e| anyhow!(RsaError::DecryptionFailed(anyhow!(e))))
Expand Down

0 comments on commit 129c538

Please sign in to comment.