Expand description
A library implementing the DomainKeys Identified Mail (DKIM) specification described in RFC 6376.
This library provides both high-level APIs for signing and verifying, as well as low-level APIs that cover the various DKIM protocol areas.
The high-level API can be used to sign email messages using DKIM signatures
(module signer), and to verify such signatures (module verifier).
Most users will want to deal with DKIM via these APIs. For convenience, all
the relevant items are re-exported at the top level.
The high-level API exposes various configuration options for both the signing and verification process. It is, however, closed, and not extensible. Instead, the low-level building blocks are provided in various additional modules. They contain basic helpers for cryptography, canonicalisation, encoding, etc. Users familiar with DKIM could use these building blocks to build their own signing and verification facilities.
§Usage
The types Signer and Verifier provide the entry points to signing
and verifying with viadkim.
See the examples for Signer and Verifier for basic usage.
§Cargo features
The feature hickory-resolver makes an implementation of trait
LookupTxt available for the Hickory DNS
resolver. LookupTxt is the abstraction used for DNS resolution during
verification.
The feature pre-rfc8301 reverts cryptographic algorithm and key usage
back to before RFC 8301: it lowers the minimum RSA key size to 512 bits,
and enables the insecure, historic SHA-1 hash algorithm. In the API and
implementation, wherever there is support for the SHA-256 hash algorithm,
with this feature additional support for SHA-1 becomes available. This is a
legacy compatibility feature, its use is discouraged.
§Trace logging
This library uses the tracing crate for internal trace logging. For
insight into library operation, install a tracing
subscriber and enable logging at trace level.
Re-exports§
pub use crate::crypto::SigningKey;pub use crate::header::FieldBody;pub use crate::header::FieldName;pub use crate::header::HeaderField;pub use crate::header::HeaderFields;pub use crate::signature::DomainName;pub use crate::signature::Selector;pub use crate::signature::SigningAlgorithm;pub use crate::signer::sign;pub use crate::signer::RequestError;pub use crate::signer::SignRequest;pub use crate::signer::Signer;pub use crate::signer::SigningError;pub use crate::signer::SigningOutput;pub use crate::signer::SigningResult;pub use crate::verifier::verify;pub use crate::verifier::Config;pub use crate::verifier::DkimResult;pub use crate::verifier::VerificationError;pub use crate::verifier::VerificationResult;pub use crate::verifier::VerificationStatus;pub use crate::verifier::Verifier;
Modules§
- canonicalize
- Canonicalization utilities.
- crypto
- Cryptographic utilities.
- header
- Representation of email header data.
- message_
hash - Computation of the message hashes.
- quoted_
printable - DKIM-Quoted-Printable encoding.
- record
- DKIM public key record.
- signature
- DKIM signature.
- signer
- Signer and supporting types.
- tag_
list - Tag=value lists.
- verifier
- Verifier and supporting types.
Structs§
- Base64
Error - An error that occurs when decoding Base64-encoded data.
Traits§
- Canonical
Str - A trait for entities that have a canonical string representation in the DKIM specification.
Functions§
- decode_
base64 - Decodes binary data from a Base64-encoded string.
- encode_
base64 - Encodes binary data as a Base64 string.