Class: MailAuth::Arc::Seal

Inherits:
Object
  • Object
show all
Defined in:
lib/mailauth/arc/seal.rb

Overview

An ARC-Seal (RFC 8617 §4.1.3), which signs the chain rather than the message: no body, no h= naming what it covers — its scope is fixed by §5.1.1 — and relaxed header canonicalization only.

Constant Summary collapse

REQUIRED_TAGS =
%w[ i a b d s cv ].freeze

Instance Method Summary collapse

Constructor Details

#initialize(sets, resolver:) ⇒ Seal

Returns a new instance of Seal.



11
12
13
14
15
# File 'lib/mailauth/arc/seal.rb', line 11

def initialize(sets, resolver:)
  @sets, @resolver = sets, resolver
  @set = sets.last
  @tags = @set.seal_tags
end

Instance Method Details

#resultObject



17
18
19
20
21
22
23
24
25
26
27
# File 'lib/mailauth/arc/seal.rb', line 17

def result
  validate

  verified? ? seal(Status::PASS) : seal(Status::FAIL, comment: "bad signature")
rescue Dkim::Malformed => error
  seal Status::PERMERROR, comment: error.message
rescue Resolver::NotFound
  seal Status::PERMERROR, comment: "no key for #{key_name}"
rescue Resolver::Timeout, Resolver::ServerFailure
  seal Status::TEMPERROR, comment: "DNS failure resolving #{key_name}"
end