Skip to content

Commit 6ea249a

Browse files
Merge pull request #23 from gasbytes/pkcs1-and-sec1-support
Refactor of ECDSA sign module, SEC1 support for ECDSA, PKCS1 for RSA-PSS and PKCS8 for RSAPKCS1
2 parents b1072da + e96ab68 commit 6ea249a

File tree

8 files changed

+561
-928
lines changed

8 files changed

+561
-928
lines changed

rustls-wolfcrypt-provider/src/lib.rs

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,7 @@ pub mod aead {
2727
pub mod sign {
2828
pub mod ecdsa;
2929
pub mod eddsa;
30-
pub mod rsapkcs1;
31-
pub mod rsapss;
30+
pub mod rsa;
3231
}
3332
use crate::aead::{aes128gcm, aes256gcm, chacha20};
3433

@@ -93,22 +92,8 @@ impl rustls::crypto::KeyProvider for Provider {
9392
) -> Result<Arc<dyn rustls::sign::SigningKey>, rustls::Error> {
9493
// Define supported algorithms as closures
9594
let algorithms: SigningAlgorithms = vec![
96-
Box::new(|key| {
97-
sign::ecdsa::EcdsaSigningKeyP256Sha256Sign::try_from(key).map(|x| Arc::new(x) as _)
98-
}),
99-
Box::new(|key| {
100-
sign::ecdsa::EcdsaSigningKeyP384Sha384Sign::try_from(key).map(|x| Arc::new(x) as _)
101-
}),
102-
Box::new(|key| {
103-
sign::ecdsa::EcdsaSigningKeyP521Sha512Sign::try_from(key).map(|x| Arc::new(x) as _)
104-
}),
105-
Box::new(|key| sign::rsapss::RsaPssPrivateKey::try_from(key).map(|x| Arc::new(x) as _)),
106-
Box::new(|key| {
107-
sign::rsapkcs1::RsaPkcs1PrivateKey::try_from(key).map(|x| Arc::new(x) as _)
108-
}),
109-
Box::new(|key| {
110-
sign::rsapkcs1::RsaPkcs1PrivateKey::try_from(key).map(|x| Arc::new(x) as _)
111-
}),
95+
Box::new(|key| sign::ecdsa::EcdsaSigningKey::try_from(key).map(|x| Arc::new(x) as _)),
96+
Box::new(|key| sign::rsa::RsaPrivateKey::try_from(key).map(|x| Arc::new(x) as _)),
11297
Box::new(|key| sign::eddsa::Ed25519PrivateKey::try_from(key).map(|x| Arc::new(x) as _)),
11398
];
11499

0 commit comments

Comments
 (0)