Karta.Auth.DKIM.KeyRecord (Karta v1.0.0)

A DKIM public key record from DNS (RFC 6376 §3.6.1; RFC 8463 §4 for Ed25519), parsed and checked.

  • v= must be DKIM1 when present; k= is rsa (the default) or ed25519; h=, when present, must allow sha256; s= must include email or *; t= flags y (testing) and s (strict identity).
  • p= empty means the key was revoked.
  • RSA keys may be published as a SubjectPublicKeyInfo (the standard form) or as a bare RSAPublicKey (some publishers do); they must have at least 1024 bits (RFC 8301 §3.2) and at most 8192, and a public exponent below 2^32 (real keys use 65537; a huge exponent would make each verification as slow as a signature). Ed25519 keys are exactly 32 octets.

Summary

Types

Why a record cannot be used; every one is a permanent error.

t()

Functions

Parses a key record (the TXT record's strings joined).

True when signature is a valid signature of the header data under this key.

Types

error()

@type error() ::
  :syntax
  | :bad_version
  | :unknown_key_type
  | :hash_not_allowed
  | :service_not_allowed
  | :revoked
  | :bad_key
  | :key_too_small
  | :key_too_large

Why a record cannot be used; every one is a permanent error.

t()

@type t() :: %Karta.Auth.DKIM.KeyRecord{
  algorithm: :rsa | :ed25519,
  bits: pos_integer(),
  key: term(),
  strict: boolean(),
  testing: boolean()
}

Functions

parse(text)

@spec parse(binary()) :: {:ok, t()} | {:error, error()}

Parses a key record (the TXT record's strings joined).

verify?(key_record, data, signature)

@spec verify?(t(), iodata(), binary()) :: boolean()

True when signature is a valid signature of the header data under this key.