Add the key type in the header
This commit is contained in:
parent
cd55e5cb83
commit
2fb6dd7c14
2 changed files with 9 additions and 1 deletions
|
@ -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(),
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Reference in a new issue