diff --git a/acmed/src/acme_proto/jws.rs b/acmed/src/acme_proto/jws.rs index 1928741..dda52bc 100644 --- a/acmed/src/acme_proto/jws.rs +++ b/acmed/src/acme_proto/jws.rs @@ -1,4 +1,4 @@ -use crate::acme_proto::jws::algorithms::{EdDsaVariant, SignatureAlgorithm}; +use crate::acme_proto::jws::algorithms::SignatureAlgorithm; use acme_common::b64_encode; use acme_common::crypto::{sha256, KeyPair}; use acme_common::error::Error; diff --git a/acmed/src/acme_proto/jws/algorithms.rs b/acmed/src/acme_proto/jws/algorithms.rs index 78c20ab..aed4ffd 100644 --- a/acmed/src/acme_proto/jws/algorithms.rs +++ b/acmed/src/acme_proto/jws/algorithms.rs @@ -1,34 +1,18 @@ -use super::jwk::{EdDsaEd25519Jwk, Es256Jwk, Jwk}; +use super::jwk::{Es256Jwk, Jwk}; use acme_common::crypto::{gen_keypair, KeyPair, KeyType}; use acme_common::error::Error; use std::fmt; use std::str::FromStr; -#[derive(Debug, PartialEq, Eq)] -pub enum EdDsaVariant { - Ed25519, -} - -impl fmt::Display for EdDsaVariant { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - let s = match self { - EdDsaVariant::Ed25519 => "Ed25519", - }; - write!(f, "{}", s) - } -} - #[derive(Debug, PartialEq, Eq)] pub enum SignatureAlgorithm { Es256, - EdDsa(EdDsaVariant), } impl fmt::Display for SignatureAlgorithm { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { let s = match self { SignatureAlgorithm::Es256 => "ES256", - SignatureAlgorithm::EdDsa(_) => "EdDSA", }; write!(f, "{}", s) } @@ -40,7 +24,6 @@ impl FromStr for SignatureAlgorithm { fn from_str(data: &str) -> Result { match data.to_lowercase().as_str() { "es256" => Ok(SignatureAlgorithm::Es256), - "eddsa-ed25519" => Ok(SignatureAlgorithm::EdDsa(EdDsaVariant::Ed25519)), _ => Err(format!("{}: unknown signature algorithm", data).into()), } } @@ -63,14 +46,13 @@ impl SignatureAlgorithm { pub fn gen_key_pair(&self) -> Result { match self { SignatureAlgorithm::Es256 => gen_keypair(KeyType::EcdsaP256), - SignatureAlgorithm::EdDsa(EdDsaVariant::Ed25519) => Err("Not implemented".into()), } } } #[cfg(test)] mod tests { - use super::{EdDsaVariant, SignatureAlgorithm}; + use super::SignatureAlgorithm; use acme_common::crypto::KeyPair; use std::str::FromStr; @@ -102,12 +84,6 @@ mod tests { } } - #[test] - fn test_eddsa_ed25519_to_str() { - let a = SignatureAlgorithm::EdDsa(EdDsaVariant::Ed25519); - assert_eq!(a.to_string().as_str(), "EdDSA"); - } - #[test] fn test_from_p256() { let pem = b"-----BEGIN PRIVATE KEY----- diff --git a/acmed/src/acme_proto/jws/jwk.rs b/acmed/src/acme_proto/jws/jwk.rs index 82d1431..7448bf3 100644 --- a/acmed/src/acme_proto/jws/jwk.rs +++ b/acmed/src/acme_proto/jws/jwk.rs @@ -4,7 +4,6 @@ use serde::Serialize; #[serde(untagged)] pub enum Jwk { Es256(Es256Jwk), - EdDsaEd25519(EdDsaEd25519Jwk), } #[derive(Serialize)] @@ -30,14 +29,3 @@ impl Es256Jwk { } } } - -#[derive(Serialize)] -pub struct EdDsaEd25519Jwk { - // TODO: implement EdDsaEd25519Jwk -} - -impl EdDsaEd25519Jwk { - pub fn new() -> Self { - EdDsaEd25519Jwk {} - } -}