Karta. Auth. ARC. Signature
(Karta v1.0.0)
The value of an ARC-Message-Signature (AMS) or ARC-Seal (AS) header field (RFC 8617 §4.1.2, §4.1.3), parsed and checked, and the instance of an ARC-Authentication-Results (AAR) field (§4.1.1).
Both signatures are DKIM tag lists (RFC 6376 §3.2,
Karta.Auth.DKIM.TagList) in which the instance tag i= (§4.2.1: one
or two digits, at least 1) takes the place of DKIM's identity. Tag names
and values are case-sensitive; an empty element between two semicolons
makes the list invalid (only a final semicolon is allowed); unknown tags
are ignored.
- AMS - required:
i,a(rsa-sha256ored25519-sha256),b,bh,d,hands; optional:c,landt. Avtag is ignored (§4.1.2). Withoutc, the canonicalisation isrelaxed/relaxed, as dkimpy and the ARC test suite have it (DKIM's default would besimple/simple; sealers setcin practice). Unlike DKIM,h=may be empty and need not name From; empty names in it are ignored; naming ARC-Seal makes it invalid (the seal of the same set is added after the signature, §5.1). - AS - required:
i,a,b,cv(none,passorfail),dands; optional:t. Its signature always uses relaxed header canonicalisation; anhtag makes it invalid (§4.1.3).
Domains are kept in lower-case ASCII form, selectors in lower case. The
instance may be up to 99 here; that a chain has at most 50 sets is the
validator's rule (Karta.Auth.ARC).
Summary
Functions
The instance of an ARC-Message-Signature or ARC-Seal value whose tag
list parses and whose i= is valid, even when the rest of it is not;
otherwise nil. The highest instance found decides the next one (§5.1).
Parses the value of an ARC-Message-Signature field.
Parses the value of an ARC-Seal field.
The instance of an ARC-Authentication-Results field and the rest of its
value (the authentication results): the value must start with i=, one
or two digits (at least 1) and a semicolon, white space allowed around
each (§4.1.1).
Types
@type error() ::
:syntax
| :missing_tag
| :bad_instance
| :unsupported_algorithm
| :bad_canonicalization
| :bad_domain
| :bad_selector
| :bad_headers
| :bad_length
| :bad_timestamp
| :bad_base64
| :bad_cv
| :h_in_seal
Why a field is unusable; any of them makes the chain fail.
@type kind() :: :message_signature | :seal
@type t() :: %Karta.Auth.ARC.Signature{ algorithm: :rsa_sha256 | :ed25519_sha256, body_hash: binary() | nil, canonicalization: {Karta.Auth.DKIM.Canonical.algorithm(), Karta.Auth.DKIM.Canonical.algorithm()}, cv: :none | :pass | :fail | nil, domain: String.t(), headers: [String.t()], instance: pos_integer(), kind: kind(), length: non_neg_integer() | nil, selector: String.t(), signature: binary(), timestamp: non_neg_integer() | nil }
Functions
@spec instance(binary()) :: pos_integer() | nil
The instance of an ARC-Message-Signature or ARC-Seal value whose tag
list parses and whose i= is valid, even when the rest of it is not;
otherwise nil. The highest instance found decides the next one (§5.1).
Parses the value of an ARC-Message-Signature field.
Parses the value of an ARC-Seal field.
@spec results_instance(binary()) :: {:ok, pos_integer(), binary()} | {:error, :bad_instance}
The instance of an ARC-Authentication-Results field and the rest of its
value (the authentication results): the value must start with i=, one
or two digits (at least 1) and a semicolon, white space allowed around
each (§4.1.1).