"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "scripts/arcsign.pl" between
Mail-DKIM-1.20220408.tar.gz and Mail-DKIM-1.20220520.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.20220408):arcsign.pl  (Mail-DKIM-1.20220520)
skipping to change at line 14 skipping to change at line 14
# Copyright (c) 2017 Standcore LLC. This program is free software. # Copyright (c) 2017 Standcore LLC. This program is free software.
# You can redistribute it and/or modify it under the terms of the # You can redistribute it and/or modify it under the terms of the
# GNU Public License as found at http://www.fsf.org/copyleft/gpl.html. # GNU Public License as found at http://www.fsf.org/copyleft/gpl.html.
# #
# Written by Jason Long, jlong@messiah.edu. # Written by Jason Long, jlong@messiah.edu.
use strict; use strict;
use warnings; use warnings;
use Mail::DKIM::ARC::Signer; use Mail::DKIM::ARC::Signer;
use Getopt::Long; use Getopt::Long::Descriptive;
use Pod::Usage; use Pod::Usage;
my $selector = "selector1"; my ($opt, $usage) = describe_options(
my $algorithm = "rsa-sha256"; "%c %o < original_email.txt",
my $chain = "ar"; [ "selector=s" => "Signing selector", {default=>'selector1'} ],
my $domain; # undef => auto-select domain [ "domain=s" => "Signing domain" ],
my $srvid; [ "algorithm=s" => "Algorithm to sign with", {default=>"sha-256"} ],
my $key_file = "private.key"; [ "srvid=s" => "Authentication-Results server domain, defaults to signing doma
my $timestamp = 12345; in" ],
my @extra_tag; [ "chain=s" => "Chain value. 'ar' means pick it up from Authentication-Results
my $debug_canonicalization; header", {default=>"ar"} ],
my $binary; [ "key=s" => "File containing private key, without BEGIN or END lines.", {defa
my $help; ult=>"private.key"} ],
my $wrap; [ "debug-canonicalization=s" => "Outputs the canonicalized message to the spec
GetOptions( ified file in addition to computing the DKIM signature. This is helpful for debu
"selector=s" => \$selector, gging canonicalization methods." ],
"domain=s" => \$domain, [ "timestamp=i" => "Timestamp to sign with, default to now", {default=>time} ]
"srvid=s" => \$srvid, ,
"chain=s" => \$chain, [ "binary" => "Read input in binary mode" ],
"key=s" => \$key_file, [ "wrap" => "Wrap original email" ],
"debug-canonicalization=s" => \$debug_canonicalization, [ "help|?" => "Show help" ],
"timestamp=i" => \$timestamp, {show_defaults=>1},
"extra-tag=s" => \@extra_tag, );
"binary" => \$binary,
"wrap" => \$wrap, if ($opt->help) {
"help|?" => \$help, print $usage->text;
) exit 1;
or pod2usage(2); }
pod2usage(1) if $help;
pod2usage("Error: unrecognized argument(s)")
unless (@ARGV == 0);
eval "use Mail::DKIM::TextWrap;" if($wrap); eval "use Mail::DKIM::TextWrap;" if($opt->wrap);
my $debugfh; my $debugfh;
if (defined $debug_canonicalization) if (defined $opt->debug_canonicalization)
{ {
open $debugfh, ">", $debug_canonicalization open $debugfh, ">", $opt->debug_canonicalization
or die "Error: cannot write $debug_canonicalization: $!\n"; or die "Error: cannot write ".$opt->debug_canonicalization.": $!\
n";
} }
if ($binary) if ($opt->binary)
{ {
binmode STDIN; binmode STDIN;
} }
my $arc = new Mail::DKIM::ARC::Signer( my $arc = new Mail::DKIM::ARC::Signer(
Domain => $domain, Domain => $opt->domain,
SrvId => $srvid, SrvId => $opt->srvid,
Chain => $chain, Chain => $opt->chain,
Algorithm => $algorithm, Algorithm => $opt->algorithm,
Selector => $selector, Selector => $opt->selector,
KeyFile => $key_file, KeyFile => $opt->key,
Debug_Canonicalization => $debugfh, Debug_Canonicalization => $debugfh,
Timestamp => $timestamp Timestamp => $opt->timestamp
); );
while (<STDIN>) while (<STDIN>)
{ {
unless ($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 $debug_canonicalization\n"; print STDERR "wrote canonicalized message to ".$opt->debug_canonicalizati on."\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
arcsign.pl [options] < original_email.txt
options:
--chain=pass|fail|none|ar
--domain=DOMAIN
--srvid=DOMAIN
--selector=SELECTOR
--key=FILE
--debug-canonicalization=FILE
--timestamp=INTEGER
--wrap
arcsign.pl --help arcsign.pl --help
to see a full description of the various options to see a full description of the various options
=head1 OPTIONS
=over
=item B<--chain>
Chain value. "ar" means pick it up from Authentication-Results header.
=item B<--key>
File containing private key, without BEGIN or END lines.
=item B<--domain>
Signing domain
=item B<--srvid>
Authentication-Results server domain, defaults to signing domain.
=item B<--debug-canonicalization>
Outputs the canonicalized message to the specified file, in addition
to computing the DKIM signature. This is helpful for debugging
canonicalization methods.
=back
=head1 AUTHORS =head1 AUTHORS
Jason Long, E<lt>jlong@messiah.eduE<gt> Jason Long, E<lt>jlong@messiah.eduE<gt>
John Levine, E<lt>john.levine@standcore.comE<gt> John Levine, E<lt>john.levine@standcore.comE<gt>
Marc Bradshaw, E<lt>marc@marcbradshaw.netE<gt>
=head1 COPYRIGHT AND LICENSE =head1 COPYRIGHT AND LICENSE
Copyright (C) 2006-2007 by Messiah College Copyright (C) 2006-2007 by Messiah College
Copyright 2017 by Standcore LLC Copyright 2017 by Standcore LLC
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the same terms as Perl itself, either Perl version 5.8.6 or, it under the same terms as Perl itself, either Perl version 5.8.6 or,
at your option, any later version of Perl 5 you may have available. at your option, any later version of Perl 5 you may have available.
=cut =cut
 End of changes. 13 change blocks. 
83 lines changed or deleted 44 lines changed or added

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