1 use Mail
::DKIM
::ARC
::Signer
;
2 use Mail
::DKIM
::TextWrap
; #recommended
5 # default option values
6 my $method = "simple/simple";
8 my $keyfile = "aux-fixed/dkim/dkim.private";
9 my $algorithm = "rsa-sha256";
12 "method=s" => \
$method,
13 "selector=s" => \
$selector,
14 "keyfile=s" => \
$keyfile,
15 "algorithm=s" => \
$algorithm,
18 # create a signer object
19 my $signer = Mail
::DKIM
::ARC
::Signer
->new(
20 Algorithm
=> $algorithm,
21 Chain
=> 'none', # or pass|fail|ar
24 Selector
=> $selector,
26 Headers
=> 'x-header:x-header2',
30 # NOTE: any email being ARC signed must have an Authentication-Results
31 # header so that the ARC seal can cover those results copied into
32 # an ARC-Authentication-Results header.
34 # read an email and pass it into the signer, one line at a time
37 # remove local line terminators
41 # use SMTP line terminators
42 $signer->PRINT("$_\015\012");
46 die 'Failed' . $signer->result_details() unless $signer->result() eq 'sealed';
48 # Get all the signature headers to prepend to the message
49 # ARC-Seal, ARC-Message-Signature and ARC-Authentication-Results
51 print $signer->as_string;