Dkim final class
Minn\Mail\Dkim · public/minn/src/Minn/Mail/Dkim.php · 110 lines
DKIM signatures (RFC 6376) as the reference's mailer writes them: rsa-sha256, relaxed header and simple body canonicalization, the standard headers signed in the order they appear (plus any extra ones the caller names), an optional identity, the signed headers copied into z= when asked, and the signature folded in 73-character pieces.
Constants and properties
| private | SIGNED = array ( 0 => 'from', 1 => 'to', 2 => 'cc', 3 => 'date', 4 => 'subject', 5 => 'reply-to', 6 => 'message-id', 7 => 'content-type', 8 => 'mime-version', 9 => 'x-mailer', ) | |
| private | bool $copyHeaders | |
| private | readonly string $domain | Promoted from the constructor. |
| private | readonly string $selector | Promoted from the constructor. |
| private | readonly string $key | Promoted from the constructor. |
| private | readonly string $passphrase | Promoted from the constructor. |
| private | readonly string $identity | Promoted from the constructor. |
Public
| new | __construct(string $domain, string $selector, string $key, string $passphrase, string $identity)# |
| |||
| method | copyingHeaders(): self# | The same signer, copying the signed headers into z= as well. | |||
| static | quotedPrintable(string $text): string# | Text with everything outside the DKIM-safe printable set written as =XX. | |||
| static | headers(string $text): string# | Relaxed header canonicalization: unfolded, names lower-cased, runs of space collapsed, values trimmed. | |||
| static | body(string $body): string# | Simple body canonicalization: CRLF line endings and exactly one at the end. | |||
| method | sign(string $text): ?string# | The base64 RSA-SHA256 signature of the text, or null when the key cannot be read. | |||
| method | signatureHeader(string $headerBlock, string $subject, string $body, int $time, array $extra, string $eol): ?string# | The DKIM-Signature header for a message, signed at $time.
|
Internals 1
Private and protected methods: how the class does its work. Not a contract; they change whenever the code is tidied.
| private | signedHeaders(string $headerBlock, array $extra): array# |
@return array{0: list<string>, 1: list<string>, 2: list<string>} names, header lines and z= copies |
Nothing matches.