diff --git a/.github/workflows/linux-pr.yml b/.github/workflows/linux-pr.yml index 47768e2..b299665 100644 --- a/.github/workflows/linux-pr.yml +++ b/.github/workflows/linux-pr.yml @@ -1,4 +1,4 @@ -name: Rust +name: Rust PR Linux on: pull_request: diff --git a/.github/workflows/windows-pr.yml b/.github/workflows/windows-pr.yml index c80f09d..fd4ce88 100644 --- a/.github/workflows/windows-pr.yml +++ b/.github/workflows/windows-pr.yml @@ -1,4 +1,4 @@ -name: Rust +name: Rust PR Windows on: pull_request: diff --git a/Cargo.toml b/Cargo.toml index d734995..07a0afb 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "cas-lib" -version = "0.2.42" +version = "0.2.43" edition = "2021" description = "Core lib for CAS" license = "Apache-2.0" diff --git a/src/asymmetric/cas_rsa.rs b/src/asymmetric/cas_rsa.rs index c82c091..6a5ffae 100644 --- a/src/asymmetric/cas_rsa.rs +++ b/src/asymmetric/cas_rsa.rs @@ -65,11 +65,7 @@ impl CASRSAEncryption for CASRSA { fn sign_threadpool(private_key: String, hash: Vec) -> Vec { let (sender, receiver) = mpsc::channel(); rayon::spawn(move || { - let private_key = - RsaPrivateKey::from_pkcs8_pem(&private_key).expect("failed to generate a key"); - let signed_data = private_key - .sign(Pkcs1v15Sign::new_unprefixed(), &hash) - .unwrap(); + let signed_data = Self::sign(private_key, hash); sender.send(signed_data); }); let signed_data = receiver.recv().unwrap(); @@ -89,13 +85,8 @@ impl CASRSAEncryption for CASRSA { fn verify_threadpool(public_key: String, hash: Vec, signed_text: Vec) -> bool { let (sender, receiver) = mpsc::channel(); rayon::spawn(move || { - let public_key = RsaPublicKey::from_pkcs1_pem(&public_key).unwrap(); - let verified = public_key.verify( - Pkcs1v15Sign::new_unprefixed(), - &hash, - &signed_text, - ); - sender.send(verified.is_err()); + let verified = Self::verify(public_key, hash, signed_text); + sender.send(verified); }); let verified = receiver.recv().unwrap(); if verified == false {