dkim

package
v1.12.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 13, 2026 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const Prefix = "v=DKIM1"

Variables

View Source
var (
	ErrVNotFirstTag           = errors.New("v not first tag")
	ErrMalformedTag           = errors.New("malformed tag")
	ErrMultipleTagPaths       = errors.New("multiple tag paths")
	ErrDuplicateTags          = errors.New("duplicate tags")
	ErrMissingPublicKeyData   = errors.New("missing public key data")
	ErrMalformedPublicKeyData = errors.New("malformed public key data")
	ErrUnexpectedTag          = errors.New("unexpected tag")
	ErrUnexpectedTagType      = errors.New("unexpected tag type")

	ErrMissingRequiredTag = errors.New("missing required tag")
)
View Source
var DkimGrammar *abnf.Grammar
View Source
var ErrBadEd25519Length = errors.New("bad ed25519 length")

Functions

func GetKeyData

func GetKeyData(data string) ([]byte, error)

func ParseKey

func ParseKey(data string, keyType string) (crypto.PublicKey, error)

Types

type Header struct {
	Version                 int         `json:"version,omitzero"`
	Algorithm               string      `json:"algorithm,omitzero"`
	Signature               string      `json:"signature,omitzero"`
	Hash                    string      `json:"hash,omitzero"`
	MessageCanonicalization string      `json:"message_canonicalization,omitzero"`
	SigningDomainIdentifier string      `json:"signing_domain_identifier,omitzero"`
	SignedHeaderFields      []string    `json:"signed_header_fields,omitzero"`
	AgentOrUserIdentifier   string      `json:"agent_or_user_identifier"`
	BodyLengthCount         string      `json:"body_length_count,omitzero"`
	QueryMethods            []string    `json:"query_methods,omitzero"`
	Selector                string      `json:"selector,omitzero"`
	SignatureTimestamp      string      `json:"signature_timestamp,omitzero"`
	SignatureExpiration     string      `json:"signature_expiration,omitzero"`
	CopiedHeaderFields      [][2]string `json:"copied_header_fields,omitzero"`

	Raw        string      `json:"raw,omitzero"`
	Domain     string      `json:"domain,omitzero"`
	Extensions [][2]string `json:"extensions,omitzero"`
}

func ParseHeader

func ParseHeader(data []byte) (*Header, error)

type Record

type Record struct {
	Version                  int      `json:"version,omitzero"`
	AcceptableHashAlgorithms []string `json:"acceptable_hash_algorithms,omitzero"`
	KeyType                  string   `json:"key_type,omitzero"`
	Notes                    string   `json:"notes,omitzero"`
	PublicKeyData            string   `json:"public_key_data,omitzero"`
	ServiceType              string   `json:"service_type,omitzero"`
	Flags                    []string `json:"flags,omitzero"`

	Raw        string      `json:"raw,omitzero"`
	Domain     string      `json:"domain,omitzero"`
	Selector   string      `json:"selector,omitzero"`
	Extensions [][2]string `json:"extensions,omitzero"`
}

func ParseRecord

func ParseRecord(data []byte) (*Record, error)

func (*Record) GetKeyType

func (r *Record) GetKeyType() string

func (*Record) GetPublicKey

func (r *Record) GetPublicKey() (crypto.PublicKey, error)

func (*Record) GetServiceType

func (r *Record) GetServiceType() string

func (*Record) GetVersion

func (r *Record) GetVersion() int

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL