Sovite.DKIM.Signature (sovite v0.6.0)

Copy Markdown View Source

A parsed DKIM-Signature: field (RFC 6376 §3.5), or the ARC-Message-Signature: field that uses the same tags (RFC 8617 §4.1.2).

Summary

Types

The signing algorithm. :rsa_sha1 is parsed so it can be refused by name (RFC 8301 §3.1).

t()

Functions

Parses a raw DKIM-Signature: field (kind: :dkim, the default) or ARC-Message-Signature: field (kind: :arc). Returns a description of the problem for a field that cannot be used.

Types

algorithm()

@type algorithm() :: :rsa_sha256 | :ed25519_sha256 | :rsa_sha1

The signing algorithm. :rsa_sha1 is parsed so it can be refused by name (RFC 8301 §3.1).

t()

@type t() :: %Sovite.DKIM.Signature{
  algorithm: algorithm(),
  body_canon: Sovite.DKIM.Canon.algorithm(),
  body_hash: binary(),
  domain: String.t(),
  expiration: non_neg_integer() | nil,
  header_canon: Sovite.DKIM.Canon.algorithm(),
  headers: [String.t()],
  identity: String.t() | nil,
  instance: pos_integer() | nil,
  length: non_neg_integer() | nil,
  raw: String.t(),
  selector: String.t(),
  signature: binary(),
  timestamp: non_neg_integer() | nil
}

Functions

parse(raw, opts \\ [])

@spec parse(String.t(), keyword()) :: {:ok, t()} | {:error, String.t()}

Parses a raw DKIM-Signature: field (kind: :dkim, the default) or ARC-Message-Signature: field (kind: :arc). Returns a description of the problem for a field that cannot be used.

The checks are those of RFC 6376 §6.1.1 that need no DNS: the required tags, the i= domain, From among the signed fields, and the expiration time against :now (Unix seconds).