Commit
Author: Mauro D [mauro@stalw.art]
Hash: f8ed0d7382b683f6f9cdef9fe962a37426ac577b
Timestamp: Fri, 30 Dec 2022 17:22:50 +0000 (1 year ago)

+8 -3 +/-3 browse
Added Sync + Send to VerifyingKey
1diff --git a/src/common/crypto.rs b/src/common/crypto.rs
2index e37d859..e74c9b3 100644
3--- a/src/common/crypto.rs
4+++ b/src/common/crypto.rs
5 @@ -129,7 +129,10 @@ pub(crate) enum VerifyingKeyType {
6 }
7
8 impl VerifyingKeyType {
9- pub(crate) fn verifying_key(&self, bytes: &[u8]) -> Result<Box<dyn VerifyingKey>> {
10+ pub(crate) fn verifying_key(
11+ &self,
12+ bytes: &[u8],
13+ ) -> Result<Box<dyn VerifyingKey + Sync + Send>> {
14 Ok(match self {
15 Self::Rsa => {
16 let inner =
17 @@ -137,7 +140,7 @@ impl VerifyingKeyType {
18 .or_else(|_| rsa::pkcs1::DecodeRsaPublicKey::from_pkcs1_der(bytes))
19 .map_err(|err| Error::CryptoError(err.to_string()))?;
20
21- Box::new(RsaPublicKey { inner }) as Box<dyn VerifyingKey>
22+ Box::new(RsaPublicKey { inner }) as Box<dyn VerifyingKey + Sync + Send>
23 }
24 Self::Ed25519 => Box::new(Ed25519PublicKey {
25 inner: ed25519_dalek::PublicKey::from_bytes(bytes)
26 diff --git a/src/common/verify.rs b/src/common/verify.rs
27index 1a54302..674a563 100644
28--- a/src/common/verify.rs
29+++ b/src/common/verify.rs
30 @@ -13,7 +13,7 @@ use crate::dkim::Canonicalization;
31 use super::crypto::{Algorithm, VerifyingKey};
32
33 pub struct DomainKey {
34- pub(crate) p: Box<dyn VerifyingKey>,
35+ pub(crate) p: Box<dyn VerifyingKey + Send + Sync>,
36 pub(crate) f: u64,
37 }
38
39 diff --git a/src/lib.rs b/src/lib.rs
40index 791a721..1025318 100644
41--- a/src/lib.rs
42+++ b/src/lib.rs
43 @@ -275,6 +275,8 @@ pub mod dmarc;
44 pub mod report;
45 pub mod spf;
46
47+ pub use sha1;
48+ pub use sha2;
49 pub use trust_dns_resolver;
50
51 pub struct Resolver {