diff --git a/src/algorithm.rs b/src/algorithm.rs index 6bd8873..0fd63ab 100644 --- a/src/algorithm.rs +++ b/src/algorithm.rs @@ -28,6 +28,13 @@ impl Algorithm { } } + pub fn key_type(&self) -> String { + match self { + Self::Ed25519Sha256 => String::from("ed25519"), + Self::Rsa2048Sha256 | Self::Rsa3072Sha256 | Self::Rsa4096Sha256 => String::from("rsa"), + } + } + pub fn gen_keys(&self) -> (String, String) { match self { Self::Ed25519Sha256 => gen_ed25519_kp(), diff --git a/src/signature.rs b/src/signature.rs index 13fc5d6..ea96ebc 100644 --- a/src/signature.rs +++ b/src/signature.rs @@ -43,8 +43,9 @@ impl Signature { pub fn get_header(&self) -> String { format!( - "DKIM-Signature: v=1; a={algorithm}; c={canonicalization}; d={sdid};\r\n\tt={timestamp}; s={selector};\r\n\th={headers};\r\n\tbh={body_hash};\r\n\tb={signature}", + "DKIM-Signature: v=1; a={algorithm}; c={canonicalization}; k={key_type};\r\n\tt={timestamp}; d={sdid};\r\n\ts={selector};\r\n\th={headers};\r\n\tbh={body_hash};\r\n\tb={signature}", algorithm=self.algorithm.display(), + key_type=self.algorithm.key_type(), canonicalization=self.canonicalization.to_string(), selector=self.selector, sdid=self.sdid,