"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "scripts/arcsign.pl" between
Mail-DKIM-1.20230630.tar.gz and Mail-DKIM-1.20230911.tar.gz

About: Mail-DKIM Perl module for implementing the DKIM (DomainKeys Identified Mail) message-signing and verifying standard for Internet mail.

arcsign.pl  (Mail-DKIM-1.20230630):arcsign.pl  (Mail-DKIM-1.20230911)
skipping to change at line 21 skipping to change at line 21
use warnings; use warnings;
use Mail::DKIM::ARC::Signer; use Mail::DKIM::ARC::Signer;
use Getopt::Long::Descriptive; use Getopt::Long::Descriptive;
use Pod::Usage; use Pod::Usage;
my ($opt, $usage) = describe_options( my ($opt, $usage) = describe_options(
"%c %o < original_email.txt", "%c %o < original_email.txt",
[ "selector=s" => "Signing selector", {default=>'selector1'} ], [ "selector=s" => "Signing selector", {default=>'selector1'} ],
[ "domain=s" => "Signing domain" ], [ "domain=s" => "Signing domain" ],
[ "algorithm=s" => "Algorithm to sign with", {default=>"sha-256"} ], [ "algorithm=s" => "Algorithm to sign with", {default=>"rsa-sha256"} ],
[ "srvid=s" => "Authentication-Results server domain, defaults to signing doma in" ], [ "srvid=s" => "Authentication-Results server domain, defaults to signing doma in" ],
[ "chain=s" => "Chain value. 'ar' means pick it up from Authentication-Results header", {default=>"ar"} ], [ "chain=s" => "Chain value. 'ar' means pick it up from Authentication-Results header", {default=>"ar"} ],
[ "key=s" => "File containing private key, without BEGIN or END lines.", {defa ult=>"private.key"} ], [ "key=s" => "File containing private key, without BEGIN or END lines.", {defa ult=>"private.key"} ],
[ "debug-canonicalization=s" => "Outputs the canonicalized message to the spec ified file in addition to computing the DKIM signature. This is helpful for debu gging canonicalization methods." ], [ "debug-canonicalization=s" => "Outputs the canonicalized message to the spec ified file in addition to computing the DKIM signature. This is helpful for debu gging canonicalization methods." ],
[ "extra-tag=s@" => "Extra tags to use in signing" ],
[ "extra-seal-tag=s@" => "Extra tags to use in sealing" ],
[ "timestamp=i" => "Timestamp to sign with, default to now", {default=>time} ] , [ "timestamp=i" => "Timestamp to sign with, default to now", {default=>time} ] ,
[ "binary" => "Read input in binary mode" ], [ "binary" => "Read input in binary mode" ],
[ "wrap" => "Wrap original email" ], [ "wrap" => "Wrap original email" ],
[ "help|?" => "Show help" ], [ "help|?" => "Show help" ],
{show_defaults=>1}, {show_defaults=>1},
); );
if ($opt->help) { if ($opt->help) {
print $usage->text; print $usage->text;
exit 1; exit 1;
} }
eval "use Mail::DKIM::TextWrap;" if($opt->wrap); eval "use Mail::DKIM::TextWrap;" if($opt->wrap);
my $debugfh; my $debugfh;
if (defined $opt->debug_canonicalization) if (defined $opt->debug_canonicalization) {
{ open $debugfh, ">", $opt->debug_canonicalization
open $debugfh, ">", $opt->debug_canonicalization or die "Error: cannot write ".$opt->debug_canonicalization.": $!\n";
or die "Error: cannot write ".$opt->debug_canonicalization.": $!\ }
n"; if ($opt->binary) {
} binmode STDIN;
if ($opt->binary) }
{
binmode STDIN; my %arc_opt;
if ($opt->extra_tag) {
$arc_opt{Tags} = {};
for my $extra ($opt->extra_tag->@*) {
my ($n, $v) = split /=/, $extra, 2;
$arc_opt{Tags}->{$n} = $v;
}
}
if ($opt->extra_seal_tag) {
$arc_opt{SealTags} = {};
for my $extra ($opt->extra_seal_tag->@*) {
my ($n, $v) = split /=/, $extra, 2;
$arc_opt{SealTags}->{$n} = $v;
}
} }
my $arc = new Mail::DKIM::ARC::Signer( my $arc = new Mail::DKIM::ARC::Signer(
Domain => $opt->domain, Domain => $opt->domain,
SrvId => $opt->srvid, SrvId => $opt->srvid,
Chain => $opt->chain, Chain => $opt->chain,
Algorithm => $opt->algorithm, Algorithm => $opt->algorithm,
Selector => $opt->selector, Selector => $opt->selector,
KeyFile => $opt->key, KeyFile => $opt->key,
Debug_Canonicalization => $debugfh, Debug_Canonicalization => $debugfh,
Timestamp => $opt->timestamp Timestamp => $opt->timestamp,
); %arc_opt,
);
while (<STDIN>) while (<STDIN>)
{ {
unless ($opt->binary) unless ($opt->binary) {
{ chomp $_;
chomp $_; s/\015?$/\015\012/s;
s/\015?$/\015\012/s; }
} $arc->PRINT($_);
$arc->PRINT($_);
} }
$arc->CLOSE; $arc->CLOSE;
if ($debugfh) if ($debugfh)
{ {
close $debugfh; close $debugfh;
print STDERR "wrote canonicalized message to ".$opt->debug_canonicalizati print STDERR "wrote canonicalized message to ".$opt->debug_canonicalization."\
on."\n"; n";
} }
print "RESULT IS " . $arc->result() . "\n"; print "RESULT IS " . $arc->result() . "\n";
if( $arc->result eq "sealed") { if( $arc->result eq "sealed") {
print join("\n",$arc->as_strings) . "\n"; print join("\n",$arc->as_strings) . "\n";
} else { } else {
print "REASON IS " . $arc->{details} . "\n"; print "REASON IS " . $arc->{details} . "\n";
} }
__END__ __END__
=head1 NAME =head1 NAME
arcsign.pl - computes ARC signatures for an email message arcsign.pl - computes ARC signatures for an email message
=head1 SYNOPSIS =head1 SYNOPSIS
 End of changes. 8 change blocks. 
30 lines changed or deleted 45 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)