| 1 | package Mail::DKIM::ARC::Signer; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | 3 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | 3 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | 3 | our $VERSION = '1.20240923'; # VERSION | |||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | # ABSTRACT: generates a DKIM signature for a message | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | # Copyright 2017 FastMail Pty Ltd. All Rights Reserved. | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | # Bron Gondwana <brong@fastmailteam.com> | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | # This program is free software; you can redistribute it and/or | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | # modify it under the same terms as Perl itself. | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | 3 | ▶ | use Mail::DKIM::PrivateKey; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | 3 | ▶ | use Mail::DKIM::ARC::MessageSignature; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | 3 | ▶ | use Mail::DKIM::ARC::Seal; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | 3 | ▶ | use Mail::AuthenticationResults::Parser; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | 3 | ▶ | use Mail::AuthenticationResults::Header::AuthServID; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | 3 | ▶ | use base 'Mail::DKIM::Common'; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | 3 | ▶ | use Carp; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | # PROPERTIES | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | # public: | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | # $signer->{Algorithm} | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | # identifies what algorithm to use when signing the message | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | # default is "rsa-sha256" | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | # $signer->{Domain} | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | # identifies what domain the message is signed for | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | # $signer->{SrvId} | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | # identifies what authserv-id is in the A-R headers | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | # $signer->{KeyFile} | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | # name of the file containing the private key used to sign | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | # $signer->{Policy} | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | # a signing policy (of type Mail::DKIM::SigningPolicy) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | # $signer->{Selector} | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | # identifies name of the selector identifying the key | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | # $signer->{Key} | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | # the loaded private key | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | # private: | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | # $signer->{algorithms} = [] | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | # an array of algorithm objects... an algorithm object is created for | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | # each signature being added to the message | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | # $signer->{result} | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | # result of the signing policy: "signed" or "skipped" | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | # $signer->{details} | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | # why we skipped this signature | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | # $signer->{signature} | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | # the created signature (of type Mail::DKIM::Signature) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | 22 | ▶ | sub init { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
init: called CC=10 SCAR=25.1
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | 22 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | 22 | $self->SUPER::init; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | 22 | ▶ | if ( defined $self->{KeyFile} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | $self->{Key} ||= | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | 5 | ▶ | Mail::DKIM::PrivateKey->load( File => $self->{KeyFile} ); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$self->{"Key"} ||= "Mail::DKIM::PrivateKey"->load("File", $self->{"KeyFile"})
MC/DC0%0/2
$self->{"Key"} ||= "Mail::DKIM::PrivateKey"->load("File", $self->{"KeyFile"})
$self->{"Key"}
"Mail::DKIM::PrivateKey"->load("File", $self->{"KeyFile"})
Truth table33%1/3
A ||= B
A= $self->{"Key"}B= "Mail::DKIM::PrivateKey"->load("File", $self->{"KeyFile"})
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | 22 | ▶ | unless ( $self->{'Algorithm'} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | # use default algorithm | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | 0 | $self->{'Algorithm'} = 'rsa-sha256'; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | 22 | ▶ | unless ( $self->{'Domain'} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | # use default domain | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | 17 | $self->{'Domain'} = 'example.org'; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | 22 | ▶ | unless ( $self->{'SrvId'} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | # use default domain | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | 5 | $self->{'SrvId'} = $self->{'Domain'}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | 22 | ▶ | unless ( $self->{'Selector'} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | # use default selector | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | 0 | $self->{'Selector'} = 'unknown'; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | 22 | $self->{result} = '?'; # better update this before we finish | |||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | die 'Invalid signing algorithm' | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | 22 | ▶ | unless $self->{Algorithm} eq 'rsa-sha256'; # add ed25519 sometime | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | die 'Need a valid chain value' | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | 22 | ▶ | unless $self->{Chain} and $self->{Chain} =~ m{^(pass|fail|none|ar)$}; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$self->{"Chain"} and $self->{"Chain"} =~ /^(pass|fail|none|ar)$/
MC/DC0%0/2
$self->{"Chain"} and $self->{"Chain"} =~ /^(pass|fail|none|ar)$/
$self->{"Chain"}
$self->{"Chain"} =~ /^(pass|fail|none|ar)$/
Truth table33%1/3
A and B
A= $self->{"Chain"}B= $self->{"Chain"} =~ /^(pass|fail|none|ar)$/
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | 22 | ▶ | sub finish_header { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
finish_header: called CC=31 SCAR=38.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | 22 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | # add the AAR header | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | 22 | my @aar; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | my @ams; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | 22 | my @as; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | 22 | my $ar; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | HEADER: | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | 22 | foreach my $header ( @{ $self->{headers} } ) { | |||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | 197 | $header =~ s/[\r\n]+$//; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | 197 | ▶ | if ( $header =~ m/^Authentication-Results:/ ) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | 29 | my ( $arval ) = $header =~ m/^Authentication-Results:[^;]*;[\t ]*(.*)/is; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | 29 | my $parsed; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | eval { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | 29 | $parsed= Mail::AuthenticationResults::Parser->new | |||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | ->parse( $header ); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | 28 | 1 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | 29 | ▶ | } || do { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | 1 | my $error = $@; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | 1 | warn "Authentication-Results Header parse error: $error\n$header"; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | 1 | next HEADER; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | 28 | my $ardom = $parsed->value->value; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | next | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | 28 | ▶ | unless "\L$ardom" eq $self->{SrvId}; # make sure it's our domain | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | 25 | $arval =~ s/;?\s*$//; # ignore trailing semicolon and whitespace | |||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | # preserve leading fold if there is one, otherwise set one leading space | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | 25 | ▶ | $arval =~ s/^\s*/ / unless ($arval =~ m/^\015\012/); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | 25 | ▶ | if ($ar) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | 5 | $ar .= ";$arval"; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | 20 | $ar = "$ardom;$arval"; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | # get chain value from A-R header | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | $self->{Chain} = $1 | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | 25 | ▶ | if $self->{Chain} eq 'ar' and $arval =~ m{\barc=(none|pass|fail)}; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$self->{"Chain"} eq "ar" and $arval =~ /\barc=(none|pass|fail)/
MC/DC100%2/2
$self->{"Chain"} eq "ar" and $arval =~ /\barc=(none|pass|fail)/
$self->{"Chain"} eq "ar"
$arval =~ /\barc=(none|pass|fail)/
Truth table100%3/3
A and B
A= $self->{"Chain"} eq "ar"B= $arval =~ /\barc=(none|pass|fail)/
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | # parse ARC headers to make sure we have completeness | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | 168 | ▶ | if ( $header =~ m/^ARC-/ ) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | 19 | ▶ | if ( !$ar ) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | 0 | $self->{result} = 'skipped'; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | $self->{details} = | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | 0 | 'ARC header seen before Authentication-Results'; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | 19 | ▶ | if ( $self->{Chain} eq 'ar' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | 1 | $self->{result} = 'skipped'; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | $self->{details} = | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | 1 | 'No ARC result found in Authentication-Results'; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | 1 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | 167 | ▶ | if ( $header =~ m/^ARC-Seal:/ ) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | 6 | my $seal = Mail::DKIM::ARC::Seal->parse($header); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | 6 | my $i = $seal->instance; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | 6 | ▶ | if ( $as[$i] ) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | 0 | $self->{result} = 'skipped'; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | 0 | $self->{details} = "Duplicate ARC-Seal $i"; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | 6 | $as[$i] = $seal; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | elsif ( $header =~ m/^ARC-Message-Signature:/ ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | 6 | my $sig = Mail::DKIM::ARC::MessageSignature->parse($header); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | 6 | my $i = $sig->instance; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | 6 | ▶ | if ( $ams[$i] ) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | 0 | $self->{result} = 'skipped'; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | $self->{details} = | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | 0 | "Duplicate ARC-Message-Signature $i"; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | 6 | $ams[$i] = $sig; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 184 | elsif ( $header =~ m/^ARC-Authentication-Results:\s*i=(\d+)/ ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | 6 | my $i = $1; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | 6 | ▶ | if ( $aar[$i] ) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 187 | 0 | $self->{result} = 'skipped'; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 188 | $self->{details} = | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 189 | 0 | "Duplicate ARC-Authentication-Results $i"; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 190 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 191 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 192 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 193 | 6 | $aar[$i] = $header; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 194 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 195 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 196 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 197 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 198 | 21 | ▶ | unless ($ar) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 199 | 2 | $self->{result} = 'skipped'; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 200 | 2 | $self->{details} = 'No authentication results seen'; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 201 | 2 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 202 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 203 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 204 | 19 | ▶ | $self->{Chain} = 'none' if ($self->{Chain} eq 'ar'); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 205 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 206 | 19 | ▶ | if ( $#ams > $#as ) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 207 | 0 | $self->{result} = 'skipped'; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 208 | 0 | $self->{details} = 'More message signatures than seals'; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 209 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 210 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 211 | 19 | ▶ | if ( $#aar > $#as ) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 212 | 0 | $self->{result} = 'skipped'; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 213 | 0 | $self->{details} = 'More authentication results than seals'; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 214 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 215 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 216 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 217 | 19 | foreach my $i ( 1 .. $#as ) { | |||||||||||||||||||||||||||||||||||||||||||||||||
| 218 | 6 | ▶ | unless ( $as[$i] ) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 219 | 0 | $self->{result} = 'skipped'; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 220 | 0 | $self->{details} = "Missing ARC-Seal $i"; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 221 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 222 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 223 | 6 | ▶ | unless ( $ams[$i] ) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 224 | 0 | $self->{result} = 'skipped'; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 225 | 0 | $self->{details} = "Missing Arc-Message-Signature $i"; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 226 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 227 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 228 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 229 | # don't care about authentication results, they are compulsary | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 230 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 231 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 232 | 19 | ▶ | $self->{_Instance} = @as || 1; # next instance value | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
@as || 1
MC/DC100%1/1
@as || 1
@as
Truth table100%2/2
A
A= @as
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 233 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 234 | # first add the AAR header | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 235 | 19 | $self->{_AAR} = "ARC-Authentication-Results: i=$self->{_Instance}; $ar"; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 236 | 19 | unshift @{ $self->{headers} }, $self->{_AAR}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 237 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 238 | # set up the signer for AMS | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 239 | $self->add_signature( | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 240 | Mail::DKIM::ARC::MessageSignature->new( | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 241 | Algorithm => $self->{Algorithm}, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 242 | Headers => $self->headers, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 243 | Instance => $self->{_Instance}, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 244 | Method => 'relaxed/relaxed', | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 245 | Domain => $self->{Domain}, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 246 | Selector => $self->{Selector}, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 247 | Key => $self->{Key}, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 248 | KeyFile => $self->{KeyFile}, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 249 | ( $self->{Timestamp} ? ( Timestamp => $self->{Timestamp} ) : () ), | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 250 | ( $self->{Expiration} ? ( Expiration => $self->{Expiration} ) : () ), | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 251 | ( | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 252 | 19 | ▶ | $self->{'Tags'} ? ( Tags => $self->{'Tags'} ) | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 253 | : () | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 254 | ), | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 255 | ) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 256 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 257 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 258 | 19 | foreach my $algorithm ( @{ $self->{algorithms} } ) { | |||||||||||||||||||||||||||||||||||||||||||||||||
| 259 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 260 | # output header as received so far into canonicalization | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 261 | 19 | foreach my $header ( @{ $self->{headers} } ) { | |||||||||||||||||||||||||||||||||||||||||||||||||
| 262 | 205 | $algorithm->add_header($header); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 263 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 264 | 19 | $algorithm->finish_header( Headers => $self->{headers} ); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 265 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 266 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 267 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 268 | 22 | ▶ | sub finish_body { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
finish_body: called CC=20 SCAR=34.5
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 269 | 22 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 270 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 271 | 22 | ▶ | if ( $self->{result} eq 'skipped' ) { # already failed | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 272 | 3 | $self->{_AS} = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 273 | 3 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 274 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 275 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 276 | 19 | foreach my $algorithm ( @{ $self->{algorithms} } ) { | |||||||||||||||||||||||||||||||||||||||||||||||||
| 277 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 278 | # finished canonicalizing | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 279 | 19 | $algorithm->finish_body; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 280 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 281 | # load the private key file if necessary | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 282 | 19 | my $signature = $algorithm->signature; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 283 | my $key = | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 284 | $signature->{Key} | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 285 | || $signature->{KeyFile} | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 286 | || $self->{Key} | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 287 | 19 | ▶ | || $self->{KeyFile}; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%3/9
$signature->{'Key'} || $signature->{'KeyFile'} || $self->{'Key'} || $self->{'KeyFile'}
$signature->{"Key"} or $signature->{"KeyFile"} or $self->{"Key"}
$signature->{"Key"} or $signature->{"KeyFile"}
MC/DC0%0/4
$signature->{'Key'} || $signature->{'KeyFile'} || $self->{'Key'} || $self->{'KeyFile'}
$signature->{"Key"}
$signature->{"KeyFile"}
$self->{"Key"}
$self->{'KeyFile'}
Truth table20%1/5
A or B or C || D
A= $signature->{"Key"}B= $signature->{"KeyFile"}C= $self->{"Key"}D= $self->{'KeyFile'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 288 | 19 | ▶ | if ( defined($key) && !ref($key) ) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $key and not ref $key
MC/DC0%0/2
defined $key and not ref $key
defined $key
not ref $key
Truth table33%1/3
A and not(B)
A= defined $keyB= not ref $key
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 289 | 0 | $key = Mail::DKIM::PrivateKey->load( File => $key ); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 290 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 291 | $key | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 292 | 19 | ▶ | or die "no key available to sign with\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 293 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 294 | # compute signature value | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 295 | 19 | my $signb64 = $algorithm->sign($key); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 296 | 19 | $signature->data($signb64); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 297 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 298 | # insert linebreaks in signature data, if desired | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 299 | 19 | $signature->prettify_safe(); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 300 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 301 | 19 | $self->{_AMS} = $signature->as_string(); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 302 | 19 | unshift @{ $self->{headers} }, $self->{_AMS}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 303 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 304 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 305 | # reset the internal state | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 306 | 19 | $self->{signatures} = []; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 307 | 19 | $self->{algorithms} = []; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 308 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 309 | $self->add_signature( | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 310 | Mail::DKIM::ARC::Seal->new( | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 311 | Algorithm => $self->{Algorithm}, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 312 | Chain => $self->{Chain}, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 313 | Headers => $self->headers, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 314 | Instance => $self->{_Instance}, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 315 | Domain => $self->{Domain}, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 316 | Selector => $self->{Selector}, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 317 | Key => $self->{Key}, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 318 | KeyFile => $self->{KeyFile}, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 319 | ( $self->{Timestamp} ? ( Timestamp => $self->{Timestamp} ) : () ), | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 320 | ( $self->{Expiration} ? ( Expiration => $self->{Expiration} ) : () ), | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 321 | ( | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 322 | 19 | ▶ | $self->{'SealTags'} ? ( Tags => $self->{'SealTags'} ) | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 323 | : () | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 324 | ), | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 325 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 326 | ) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 327 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 328 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 329 | 19 | foreach my $algorithm ( @{ $self->{algorithms} } ) { | |||||||||||||||||||||||||||||||||||||||||||||||||
| 330 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 331 | # output header as received so far into canonicalization | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 332 | 19 | foreach my $header ( @{ $self->{headers} } ) { | |||||||||||||||||||||||||||||||||||||||||||||||||
| 333 | 224 | $algorithm->add_header($header); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 334 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 335 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 336 | # chain needed for seal canonicalization | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 337 | $algorithm->finish_header( | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 338 | Headers => $self->{headers}, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 339 | Chain => $self->{Chain} | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 340 | 19 | ); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 341 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 342 | # no body is required for ARC-Seal | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 343 | # finished canonicalizing | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 344 | 19 | $algorithm->finish_body; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 345 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 346 | # load the private key file if necessary | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 347 | 19 | my $signature = $algorithm->signature; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 348 | my $key = | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 349 | $signature->{Key} | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 350 | || $signature->{KeyFile} | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 351 | || $self->{Key} | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 352 | 19 | ▶ | || $self->{KeyFile}; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%3/9
$signature->{'Key'} || $signature->{'KeyFile'} || $self->{'Key'} || $self->{'KeyFile'}
$signature->{"Key"} or $signature->{"KeyFile"} or $self->{"Key"}
$signature->{"Key"} or $signature->{"KeyFile"}
MC/DC0%0/4
$signature->{'Key'} || $signature->{'KeyFile'} || $self->{'Key'} || $self->{'KeyFile'}
$signature->{"Key"}
$signature->{"KeyFile"}
$self->{"Key"}
$self->{'KeyFile'}
Truth table20%1/5
A or B or C || D
A= $signature->{"Key"}B= $signature->{"KeyFile"}C= $self->{"Key"}D= $self->{'KeyFile'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 353 | 19 | ▶ | if ( defined($key) && !ref($key) ) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $key and not ref $key
MC/DC0%0/2
defined $key and not ref $key
defined $key
not ref $key
Truth table33%1/3
A and not(B)
A= defined $keyB= not ref $key
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 354 | 0 | $key = Mail::DKIM::PrivateKey->load( File => $key ); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 355 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 356 | $key | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 357 | 19 | ▶ | or die "no key available to sign ARC-Seal\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 358 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 359 | # compute signature value | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 360 | 19 | my $signb64 = $algorithm->sign($key); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 361 | 19 | $signature->data($signb64); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 362 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 363 | # insert linebreaks in signature data, if desired | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 364 | 19 | $signature->prettify_safe(); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 365 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 366 | 19 | $self->{_AS} = $signature->as_string(); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 367 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 368 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 369 | 19 | $self->{result} = 'sealed'; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 370 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 371 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 372 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 373 | 38 | ▶ | sub add_signature { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
add_signature: called CC=3 SCAR=11.6
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 374 | 38 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 375 | 38 | my $signature = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 376 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 377 | # create a canonicalization filter and algorithm | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 378 | 38 | ▶ | my $algorithm_class = | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/2
$signature->algorithm || ''
MC/DC0%0/1
$signature->algorithm || ''
$signature->algorithm
Truth table0%0/2
A
A= $signature->algorithm
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 379 | $signature->get_algorithm_class( $signature->algorithm ) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 380 | or die 'unsupported algorithm ' . ( $signature->algorithm || '' ) . "\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 381 | my $algorithm = $algorithm_class->new( | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 382 | Signature => $signature, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 383 | Debug_Canonicalization => $self->{Debug_Canonicalization}, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 384 | 38 | ); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 385 | 38 | push @{ $self->{algorithms} }, $algorithm; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 386 | 38 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 387 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 388 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 389 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 390 | 0 | ▶ | sub algorithm { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
algorithm: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 391 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 392 | 0 | ▶ | if ( @_ == 1 ) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 393 | 0 | $self->{Algorithm} = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 394 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 395 | 0 | return $self->{Algorithm}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 396 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 397 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 398 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 399 | 0 | ▶ | sub domain { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
domain: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 400 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 401 | 0 | ▶ | if ( @_ == 1 ) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 402 | 0 | $self->{Domain} = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 403 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 404 | 0 | return $self->{Domain}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 405 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 406 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 407 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 408 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 409 | # these are headers that "should" be included in the signature, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 410 | # according to the DKIM spec. | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 411 | 3 | my @DEFAULT_HEADERS = qw(From Sender Reply-To Subject Date | |||||||||||||||||||||||||||||||||||||||||||||||||
| 412 | Message-ID To Cc MIME-Version | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 413 | Content-Type Content-Transfer-Encoding Content-ID Content-Description | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 414 | Resent-Date Resent-From Resent-Sender Resent-To Resent-cc | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 415 | Resent-Message-ID | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 416 | In-Reply-To References | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 417 | List-Id List-Help List-Unsubscribe List-Subscribe | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 418 | List-Post List-Owner List-Archive); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 419 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 420 | 0 | ▶ | sub process_headers_hash { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
process_headers_hash: not called CC=19 SCAR=59.4
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 421 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 422 | 0 | my @headers; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 423 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 424 | # these are the header fields we found in the message we're signing | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 425 | 0 | my @found_headers = @{ $self->{header_field_names} }; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 426 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 427 | # Convert all keys to lower case | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 428 | 0 | foreach my $header ( keys %{ $self->{'ExtendedHeaders'} } ) { | |||||||||||||||||||||||||||||||||||||||||||||||||
| 429 | 0 | ▶ | next if $header eq lc $header; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 430 | 0 | ▶ | if ( exists $self->{'ExtendedHeaders'}->{ lc $header } ) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 431 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 432 | # Merge | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 433 | 0 | my $first = $self->{'ExtendedHeaders'}->{ lc $header }; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 434 | 0 | my $second = $self->{'ExtendedHeaders'}->{$header}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 435 | 0 | ▶ | if ( $first eq '+' || $second eq '+' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition0%0/3
$first eq "+" or $second eq "+"
MC/DC0%0/2
$first eq "+" or $second eq "+"
$first eq "+"
$second eq "+"
Truth table0%0/3
A or B
A= $first eq "+"B= $second eq "+"
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 436 | 0 | $self->{'ExtendedHeaders'}->{ lc $header } = '+'; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 437 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 438 | ▶ | elsif ( $first eq '*' || $second eq '*' ) { | |||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$first eq "*" or $second eq "*"
MC/DC0%0/2
$first eq "*" or $second eq "*"
$first eq "*"
$second eq "*"
Truth table0%0/3
A or B
A= $first eq "*"B= $second eq "*"
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 439 | 0 | $self->{'ExtendedHeaders'}->{ lc $header } = '*'; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 440 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 441 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 442 | 0 | $self->{'ExtendedHeaders'}->{ lc $header } = $first + $second; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 443 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 444 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 445 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 446 | # Rename | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 447 | $self->{'ExtendedHeaders'}->{ lc $header } = | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 448 | 0 | $self->{'ExtendedHeaders'}->{$header}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 449 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 450 | 0 | delete $self->{'ExtendedHeaders'}->{$header}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 451 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 452 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 453 | # Add the default headers | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 454 | 0 | ▶ | if ( !$self->{'NoDefaultHeaders'} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 455 | 0 | foreach my $default (@DEFAULT_HEADERS) { | |||||||||||||||||||||||||||||||||||||||||||||||||
| 456 | 0 | ▶ | if ( !exists $self->{'ExtendedHeaders'}->{ lc $default } ) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 457 | 0 | $self->{'ExtendedHeaders'}->{ lc $default } = '*'; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 458 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 459 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 460 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 461 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 462 | # Build a count of found headers | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 463 | 0 | my $header_counts = {}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 464 | 0 | foreach my $header (@found_headers) { | |||||||||||||||||||||||||||||||||||||||||||||||||
| 465 | 0 | ▶ | if ( !exists $header_counts->{ lc $header } ) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 466 | 0 | $header_counts->{ lc $header } = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 467 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 468 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 469 | 0 | $header_counts->{ lc $header } = $header_counts->{ lc $header } + 1; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 470 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 471 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 472 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 473 | 0 | foreach my $header ( sort keys %{ $self->{'ExtendedHeaders'} } ) { | |||||||||||||||||||||||||||||||||||||||||||||||||
| 474 | 0 | my $want_count = $self->{'ExtendedHeaders'}->{$header}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 475 | 0 | ▶ | my $have_count = $header_counts->{ lc $header } || 0; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$$header_counts{lc $header} || 0
MC/DC0%0/1
$$header_counts{lc $header} || 0
$$header_counts{lc $header}
Truth table0%0/2
A
A= $$header_counts{lc $header}
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 476 | 0 | my $add_count = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 477 | 0 | ▶ | if ( $want_count eq '+' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 478 | 0 | $add_count = $have_count + 1; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 479 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 480 | elsif ( $want_count eq '*' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 481 | 0 | $add_count = $have_count; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 482 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 483 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 484 | 0 | ▶ | if ( $want_count > $have_count ) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 485 | 0 | $add_count = $have_count; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 486 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 487 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 488 | 0 | $add_count = $want_count; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 489 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 490 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 491 | 0 | for ( 1 .. $add_count ) { | |||||||||||||||||||||||||||||||||||||||||||||||||
| 492 | 0 | push @headers, $header; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 493 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 494 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 495 | 0 | return join( ':', @headers ); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 496 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 497 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 498 | 0 | ▶ | sub extended_headers { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
extended_headers: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 499 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 500 | 0 | $self->{'ExtendedHeaders'} = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 501 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 502 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 503 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 504 | 38 | ▶ | sub headers { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
headers: called CC=5 SCAR=16.2
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 505 | 38 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 506 | 38 | ▶ | croak 'unexpected argument' if @_; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 507 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 508 | 38 | ▶ | if ( exists $self->{'ExtendedHeaders'} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 509 | 0 | return $self->process_headers_hash(); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 510 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 511 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 512 | # these are the header fields we found in the message we're signing | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 513 | 38 | my @found_headers = @{ $self->{header_field_names} }; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 514 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 515 | # these are the headers we actually want to sign | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 516 | 38 | my @wanted_headers; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 517 | 38 | ▶ | if ( !$self->{'NoDefaultHeaders'} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 518 | 6 | @wanted_headers = @DEFAULT_HEADERS; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 519 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 520 | 38 | ▶ | if ( $self->{Headers} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 521 | 32 | push @wanted_headers, split /:/, $self->{Headers}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 522 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 523 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 524 | my @headers = | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 525 | grep { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 526 | 38 | my $a = $_; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 527 | 372 | scalar grep { lc($a) eq lc($_) } @wanted_headers | |||||||||||||||||||||||||||||||||||||||||||||||||
| 528 | } @found_headers; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 529 | 38 | return join( ':', @headers ); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 530 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 531 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 532 | # return nonzero if this is header we should sign | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 533 | 0 | ▶ | sub want_header { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
want_header: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 534 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 535 | 0 | my ($header_name) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 536 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 537 | #TODO- provide a way for user to specify which headers to sign | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 538 | 0 | return scalar grep { lc($_) eq lc($header_name) } @DEFAULT_HEADERS; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 539 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 540 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 541 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 542 | 0 | ▶ | sub key { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
key: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 543 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 544 | 0 | ▶ | if (@_) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 545 | 0 | $self->{Key} = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 546 | 0 | $self->{KeyFile} = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 547 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 548 | 0 | return $self->{Key}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 549 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 550 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 551 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 552 | 0 | ▶ | sub key_file { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
key_file: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 553 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 554 | 0 | ▶ | if (@_) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 555 | 0 | $self->{Key} = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 556 | 0 | $self->{KeyFile} = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 557 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 558 | 0 | return $self->{KeyFile}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 559 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 560 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 561 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 562 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 563 | 0 | ▶ | sub selector { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
selector: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 564 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 565 | 0 | ▶ | if ( @_ == 1 ) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 566 | 0 | $self->{Selector} = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 567 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 568 | 0 | return $self->{Selector}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 569 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 570 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 571 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 572 | 0 | ▶ | sub signatures { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
signatures: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 573 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 574 | 0 | ▶ | croak 'no arguments allowed' if @_; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 575 | 0 | return map { $_->signature } @{ $self->{algorithms} }; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 576 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 577 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 578 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 579 | 17 | ▶ | sub as_string { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
as_string: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 580 | 17 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 581 | 17 | ▶ | return '' unless $self->{_AS}; # skipped, no signature | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 582 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 583 | 16 | return join( "\015\012", $self->{_AS}, $self->{_AMS}, $self->{_AAR}, '' ); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 584 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 585 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 586 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 587 | 3 | ▶ | sub as_strings { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
as_strings: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 588 | 3 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 589 | 3 | return ( $self->{_AS}, $self->{_AMS}, $self->{_AAR} ); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 590 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 591 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 592 | 3 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 593 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 594 | __END__ | ||||||||||||||||||||||||||||||||||||||||||||||||||