From c8fefd0612a4f1afabb6ac2f3a2e5ec63c253001 Mon Sep 17 00:00:00 2001 From: est31 Date: Fri, 1 Mar 2024 03:31:21 +0100 Subject: [PATCH] Add rsa support to rustls-cert-gen --- rustls-cert-gen/src/cert.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/rustls-cert-gen/src/cert.rs b/rustls-cert-gen/src/cert.rs index a1251433..ec225482 100644 --- a/rustls-cert-gen/src/cert.rs +++ b/rustls-cert-gen/src/cert.rs @@ -205,6 +205,7 @@ impl EndEntityBuilder { /// Supported Keypair Algorithms #[derive(Clone, Copy, Debug, Default, Bpaf, PartialEq)] pub enum KeyPairAlgorithm { + Rsa, Ed25519, #[default] EcdsaP256, @@ -214,6 +215,7 @@ pub enum KeyPairAlgorithm { impl fmt::Display for KeyPairAlgorithm { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { match self { + KeyPairAlgorithm::Rsa => write!(f, "rsa"), KeyPairAlgorithm::Ed25519 => write!(f, "ed25519"), KeyPairAlgorithm::EcdsaP256 => write!(f, "ecdsa-p256"), KeyPairAlgorithm::EcdsaP384 => write!(f, "ecdsa-p384"), @@ -225,6 +227,7 @@ impl KeyPairAlgorithm { /// Return an `rcgen::KeyPair` for the given varient fn to_key_pair(self) -> Result { match self { + KeyPairAlgorithm::Rsa => rcgen::KeyPair::generate_for(&rcgen::PKCS_RSA_SHA256), KeyPairAlgorithm::Ed25519 => { use ring::signature::Ed25519KeyPair;