| 1 | package Mail::DKIM::PublicKey; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | 20 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | 20 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | 20 | our $VERSION = '1.20261116'; # VERSION | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | # ABSTRACT: Represents a DKIM key | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | # Copyright 2005 Messiah College. All rights reserved. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | # Jason Long <jlong@messiah.edu> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | # Copyright (c) 2004 Anthony D. Urso. All rights reserved. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | # This program is free software; you can redistribute it and/or | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | # modify it under the same terms as Perl itself. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | 20 | ▶ | use base ( 'Mail::DKIM::KeyValueList', 'Mail::DKIM::Key' ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | 20 | *calculate_EM = \&Mail::DKIM::Key::calculate_EM; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | 20 | ▶ | use Crypt::OpenSSL::RSA; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | 20 | ▶ | use Crypt::PK::Ed25519; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | 20 | ▶ | use MIME::Base64; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | 20 | ▶ | use Mail::DKIM::DNS; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | 358 | ▶ | sub new { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | 358 | my $type = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | 358 | my %prms = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | 358 | my $self = {}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | 358 | $self->{'GRAN'} = $prms{'Granularity'}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | 358 | $self->{'NOTE'} = $prms{'Note'}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | 358 | $self->{'TEST'} = $prms{'Testing'}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | 358 | ▶ | $self->{'TYPE'} = ( $prms{'Type'} or 'rsa' ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$prms{'Type'} || 'rsa'
MC/DC0%0/1
$prms{'Type'} || 'rsa'
$prms{'Type'}
Truth table50%1/2
A
A= $prms{'Type'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | 358 | $self->{'DATA'} = $prms{'Data'}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | 358 | bless $self, $type; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | 2 | ▶ | sub fetch { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
fetch: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | 2 | my $class = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | 2 | my $waiter = $class->fetch_async(@_); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | 2 | my $self = $waiter->(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | 2 | return $self; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | # fetch_async() - asynchronously tries fetching a specific public key | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | # using a specific protocol. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | # Usage: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | # my $fut = Mail::DKIM::PublicKey->fetch_async( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | # Protocol => 'dns/txt', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | # Selector => 'selector1', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | # Domain => 'example.org', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | # Callbacks => { ... }, #optional | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | # ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | # # some later time | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | # my $pubkey = $fut->(); # blocks until the public key is returned | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | 586 | ▶ | sub fetch_async { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
fetch_async: called CC=9 SCAR=22.7
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | 586 | my $class = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | 586 | my %prms = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | 586 | ▶ | defined( $prms{Protocol} ) && $prms{Protocol} =~ m{^dns(/txt)?$}s | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $prms{"Protocol"} and $prms{"Protocol"} =~ m[^dns(/txt)?$]s
MC/DC0%0/2
defined $prms{"Protocol"} and $prms{"Protocol"} =~ m[^dns(/txt)?$]s
defined $prms{"Protocol"}
$prms{"Protocol"} =~ m[^dns(/txt)?$]s
Truth table33%1/3
A and B
A= defined $prms{"Protocol"}B= $prms{"Protocol"} =~ m[^dns(/txt)?$]s
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | or die "invalid/missing Protocol\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | defined( $prms{Selector} ) && length( $prms{Selector} ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | 586 | ▶ | or die "invalid/missing Selector\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
defined $prms{"Selector"} and length $prms{"Selector"}
MC/DC50%1/2
defined $prms{"Selector"} and length $prms{"Selector"}
defined $prms{"Selector"}
length $prms{"Selector"}
Truth table66%2/3
A and B
A= defined $prms{"Selector"}B= length $prms{"Selector"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | defined( $prms{Domain} ) && length( $prms{Domain} ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | 584 | ▶ | or die "invalid/missing Domain\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $prms{"Domain"} and length $prms{"Domain"}
MC/DC0%0/2
defined $prms{"Domain"} and length $prms{"Domain"}
defined $prms{"Domain"}
length $prms{"Domain"}
Truth table33%1/3
A and B
A= defined $prms{"Domain"}B= length $prms{"Domain"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | 584 | ▶ | my %callbacks = %{ $prms{Callbacks} || {} }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$prms{'Callbacks'} || {}
MC/DC100%1/1
$prms{'Callbacks'} || {}
$prms{'Callbacks'}
Truth table100%2/2
A
A= $prms{'Callbacks'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | 584 | ▶ | my $on_success = $callbacks{Success} || sub { $_[0] }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.1
Condition66%2/3
$callbacks{'Success'} || sub {
$_[0];
}
MC/DC0%0/2
$callbacks{'Success'} || sub {
$_[0];
}
$callbacks{'Success'}
sub {
$_[0];
}
Truth table66%2/3
A || B
A= $callbacks{'Success'}B= sub {
$_[0];
}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | 488 | ▶ | $callbacks{Success} = sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=7 SCAR=19.7
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | 488 | my @resp = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | 488 | ▶ | unless (@resp) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | # no requested resource records or NXDOMAIN, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | 131 | return $on_success->(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | 357 | my $strn; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | 357 | foreach my $rr (@resp) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | 357 | ▶ | next unless $rr->type eq 'TXT'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | # join with no intervening spaces, RFC 6376 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | 357 | ▶ | if ( $rr->can('txtdata') ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | # must call txtdata() in a list context | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | 357 | $strn = join '', $rr->txtdata; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | # char_str_list method is 'historical' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | 0 | $strn = join '', $rr->char_str_list; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | 357 | last; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | $strn | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | 357 | ▶ | or return $on_success->(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | 357 | my $self = $class->parse($strn); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | 354 | $self->{Selector} = $prms{'Selector'}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | 354 | $self->{Domain} = $prms{'Domain'}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | 354 | ▶ | $self->{TYPE} = $self->get_tag('k') || 'rsa'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$self->get_tag('k') || 'rsa'
MC/DC100%1/1
$self->get_tag('k') || 'rsa'
$self->get_tag('k')
Truth table100%2/2
A
A= $self->get_tag('k')
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | 354 | $self->check; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | 349 | return $on_success->($self); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | 584 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | # perform DNS query for public key... | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | 584 | my $host = $prms{Selector} . '._domainkey.' . $prms{Domain}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | 584 | my $waiter = | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | Mail::DKIM::DNS::query_async( $host, 'TXT', Callbacks => \%callbacks, ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | 584 | return $waiter; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | # check syntax of the public key | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | # throw an error if any errors are detected | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | 354 | ▶ | sub check { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
check: called CC=16 SCAR=28.2
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | 354 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | # check public key version tag | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | 354 | ▶ | if ( my $v = $self->get_tag('v') ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | 334 | ▶ | unless ( $v eq 'DKIM1' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | 1 | die "unsupported version\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | # check public key granularity | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | 353 | my $g = $self->granularity; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | # check key type | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | 353 | ▶ | if ( my $k = $self->get_tag('k') ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | 328 | ▶ | unless ( $k eq 'rsa' || $k eq 'ed25519' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$k eq "rsa" or $k eq "ed25519"
MC/DC100%2/2
$k eq "rsa" or $k eq "ed25519"
$k eq "rsa"
$k eq "ed25519"
Truth table100%3/3
A or B
A= $k eq "rsa"B= $k eq "ed25519"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | 1 | die "unsupported key type\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | # check public-key data | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | 352 | my $p = $self->data; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | 352 | ▶ | if ( not defined $p ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | 0 | die "missing p= tag\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | 352 | ▶ | if ( $p eq '' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | 1 | die "revoked\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | 351 | ▶ | unless ( $p =~ /^[A-Za-z0-9\+\/\=]+$/ ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | 0 | die "invalid data\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | # have OpenSSL load the key | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | eval { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | 351 | local $SIG{__DIE__}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | 351 | $self->cork; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | 350 | 1 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | 351 | ▶ | } || do { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | # see also finish_body | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | 1 | chomp( my $E = $@ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | 1 | ▶ | if ( $E =~ /(OpenSSL error: .*?) at / ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | 0 | $E = "$1"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | elsif ( $E =~ /^(panic:.*?) at / ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | 0 | $E = "OpenSSL $1"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | elsif ( $E =~ /^FATAL: (.*) at / ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | 1 | $E = "Ed25519 $1"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | 1 | die "$E\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | # check service type | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | 350 | ▶ | if ( my $s = $self->get_tag('s') ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | 22 | my @list = split( /:/, $s ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | 22 | ▶ | unless ( grep { $_ eq '*' || $_ eq 'email' } @list ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$_ eq '*' || $_ eq 'email'
MC/DC100%2/2
$_ eq '*' || $_ eq 'email'
$_ eq '*'
$_ eq 'email'
Truth table100%3/3
A || B
A= $_ eq '*'B= $_ eq 'email'
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | 1 | die "does not support email\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 184 | 349 | return 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 187 | # check_granularity() - check whether this key matches signature identity | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 188 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 189 | # a public key record can restrict what identities it may sign with, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 190 | # g=, granularity, restricts the local part of the identity | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 191 | # t=s, restricts whether subdomains can be used | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 192 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 193 | # This method returns true if the given identity is allowed by this | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 194 | # public key; it returns false otherwise. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 195 | # If false is returned, you can check C<$@> for an explanation of | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 196 | # why. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 197 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 198 | 346 | ▶ | sub check_granularity { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
check_granularity: called CC=13 SCAR=25.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 199 | 346 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 200 | 346 | my ( $identity, $empty_g_means_wildcard ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 201 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 202 | # check granularity | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 203 | 346 | my $g = $self->granularity; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 204 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 205 | # yuck- what is this $empty_g_means_wildcard parameter? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 206 | # well, it turns out that with DomainKeys signatures, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 207 | # an empty g= is the same as g=* | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 208 | 346 | ▶ | if ( $g eq '' && $empty_g_means_wildcard ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$g eq "" and $empty_g_means_wildcard
MC/DC100%2/2
$g eq "" and $empty_g_means_wildcard
$g eq ""
$empty_g_means_wildcard
Truth table100%3/3
A and B
A= $g eq ""B= $empty_g_means_wildcard
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 209 | 1 | $g = '*'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 210 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 211 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 212 | # split i= value into a "local part" and a "domain part" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 213 | 346 | my ( $local_part, $domain_part ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 214 | 346 | ▶ | if ( $identity =~ /^(.*)\@([^@]*)$/ ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 215 | 61 | $local_part = $1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 216 | 61 | $domain_part = $2; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 217 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 218 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 219 | 285 | $local_part = ''; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 220 | 285 | $domain_part = $identity; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 221 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 222 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 223 | 346 | my ( $begins, $ends ) = split /\*/, $g, 2; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 224 | 346 | ▶ | if ( defined $ends ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 225 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 226 | # the g= tag contains an asterisk | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 227 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 228 | # the local part must be at least as long as the pattern | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 229 | 345 | ▶ | if ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition88%8/9
length $local_part < length($begins) + length($ends) or substr($local_part, 0, length $begins) ne $begins or length $ends and substr($local_part, -length($ends)) ne $ends
length $local_part < length($begins) + length($ends) or substr($local_part, 0, length $begins) ne $begins
length $ends and substr($local_part, -length($ends)) ne $ends
MC/DC75%3/4
length $local_part < length($begins) + length($ends) or substr($local_part, 0, length $begins) ne $begins or length $ends and substr($local_part, -length($ends)) ne $ends
length $local_part < length($begins) + length($ends)
substr($local_part, 0, length $begins) ne $begins
length $ends
substr($local_part, -length($ends)) ne $ends
Truth table80%4/5
A or B or C and D
A= length $local_part < length($begins) + length($ends)B= substr($local_part, 0, length $begins) ne $beginsC= length $endsD= substr($local_part, -length($ends)) ne $ends
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 230 | length($local_part) < length($begins) + length($ends) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 231 | or | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 232 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 233 | # the local part must begin with $begins | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 234 | substr( $local_part, 0, length($begins) ) ne $begins | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 235 | or | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 236 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 237 | # the local part must end with $ends | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 238 | ( length($ends) && substr( $local_part, -length($ends) ) ne $ends ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 239 | ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 240 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 241 | 3 | $@ = "granularity mismatch\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 242 | 3 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 243 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 244 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 245 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 246 | 1 | ▶ | if ( $g eq '' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 247 | 1 | $@ = "granularity is empty\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 248 | 1 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 249 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 250 | 0 | ▶ | unless ( $local_part eq $begins ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 251 | 0 | $@ = "granularity mismatch\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 252 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 253 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 254 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 255 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 256 | # check subdomains | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 257 | 342 | ▶ | if ( $self->subdomain_flag ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 258 | 2 | ▶ | unless ( lc( $domain_part ) eq lc( $self->{'Domain'} ) ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 259 | 1 | $@ = "does not support signing subdomains\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 260 | 1 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 261 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 262 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 263 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 264 | 341 | return 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 265 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 266 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 267 | # returns true if the actual hash algorithm used is listed by this | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 268 | # public key; dies otherwise | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 269 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 270 | 348 | ▶ | sub check_hash_algorithm { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
check_hash_algorithm: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 271 | 348 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 272 | 348 | my ($hash_algorithm) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 273 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 274 | # check hash algorithm | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 275 | 348 | ▶ | if ( my $h = $self->get_tag('h') ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 276 | 14 | my @list = split( /:/, $h ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 277 | 14 | ▶ | unless ( grep { $_ eq $hash_algorithm } @list ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 278 | 2 | die "does not support hash algorithm '$hash_algorithm'\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 279 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 280 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 281 | 346 | return 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 282 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 283 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 284 | # Create an OpenSSL public key object from the Base64-encoded data | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 285 | # found in this public key's DNS record. The OpenSSL object is saved | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 286 | # in the "cork" property. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 287 | 347 | ▶ | sub _convert_rsa { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_convert_rsa: called CC=3 SCAR=11.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 288 | 347 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 289 | # have to PKCS1ify the pubkey because openssl is too finicky... | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 290 | 347 | my $cert = "-----BEGIN PUBLIC KEY-----\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 291 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 292 | 347 | ▶ | for ( my $i = 0 ; $i < length $self->data ; $i += 64 ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 293 | 1331 | $cert .= substr $self->data, $i, 64; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 294 | 1331 | $cert .= "\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 295 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 296 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 297 | 347 | $cert .= "-----END PUBLIC KEY-----\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 298 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 299 | 347 | ▶ | my $cork = Crypt::OpenSSL::RSA->new_public_key($cert) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 300 | or die 'unable to generate public key object'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 301 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 302 | # segfaults on my machine | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 303 | # $cork->check_key or | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 304 | # return; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 305 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 306 | 347 | $self->cork($cork); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 307 | 347 | return 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 308 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 309 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 310 | 4 | ▶ | sub _convert_ed25519 { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_convert_ed25519: called CC=3 SCAR=11.2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 311 | 4 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 312 | 4 | ▶ | my $cork = Crypt::PK::Ed25519->new | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 313 | or die 'unable to generate Ed25519 public key object'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 314 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 315 | 4 | my $keybin = decode_base64($self->data); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 316 | 4 | ▶ | $cork->import_key_raw($keybin, 'public') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 317 | or die 'failed to load Ed25519 public key'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 318 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 319 | 3 | $self->cork($cork); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 320 | 3 | return 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 321 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 322 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 323 | 351 | ▶ | sub convert { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
convert: called CC=5 SCAR=16.5
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 324 | 351 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 325 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 326 | 351 | my $k_tag = $self->get_tag('k'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 327 | 351 | ▶ | $k_tag = 'rsa' unless defined $k_tag; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 328 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 329 | 351 | ▶ | $self->data | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 330 | or return; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 331 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 332 | 351 | ▶ | return $self->_convert_rsa if $k_tag eq 'rsa'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 333 | 4 | ▶ | return $self->_convert_ed25519 if $k_tag eq 'ed25519'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 334 | 0 | die 'unsupported key type'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 335 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 336 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 337 | 0 | ▶ | sub verify { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
verify: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 338 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 339 | 0 | my %prms = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 340 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 341 | 0 | my $rtrn; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 342 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 343 | eval { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 344 | 0 | local $SIG{__DIE__}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 345 | 0 | $rtrn = $self->cork->verify( $prms{'Text'}, $prms{'Signature'} ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 346 | 0 | 1 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 347 | 0 | ▶ | } || do { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 348 | 0 | $self->errorstr($@); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 349 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 350 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 351 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 352 | 0 | return $rtrn; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 353 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 354 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 355 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 356 | 699 | ▶ | sub granularity { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
granularity: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 357 | 699 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 358 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 359 | # set new granularity if provided | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 360 | 699 | ▶ | (@_) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 361 | and $self->set_tag( 'g', shift ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 362 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 363 | 699 | my $g = $self->get_tag('g'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 364 | 699 | ▶ | if ( defined $g ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 365 | 44 | return $g; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 366 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 367 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 368 | 655 | return '*'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 369 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 370 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 371 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 372 | 0 | ▶ | sub notes { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
notes: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 373 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 374 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 375 | 0 | ▶ | (@_) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 376 | and $self->set_tag( 'n', shift ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 377 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 378 | 0 | return $self->get_tag('n'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 379 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 380 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 381 | 3716 | ▶ | sub data { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
data: called CC=3 SCAR=11.3
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 382 | 3716 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 383 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 384 | 3716 | ▶ | (@_) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 385 | and $self->set_tag( 'p', shift ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 386 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 387 | 3716 | my $p = $self->get_tag('p'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 388 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 389 | # remove whitespace (actually only LWSP is allowed) and double quote (long string delimiter) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 390 | 3716 | ▶ | $p =~ tr/\015\012 \t"//d if defined $p; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 391 | 3716 | return $p; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 392 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 393 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 394 | 342 | ▶ | sub flags { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
flags: called CC=3 SCAR=11.1
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 395 | 342 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 396 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 397 | 342 | ▶ | (@_) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 398 | and $self->set_tag( 't', shift ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 399 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 400 | 342 | ▶ | return $self->get_tag('t') || ''; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$self->get_tag('t') || ''
MC/DC100%1/1
$self->get_tag('t') || ''
$self->get_tag('t')
Truth table100%2/2
A
A= $self->get_tag('t')
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 401 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 402 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 403 | # subdomain_flag() - checks whether "s" is specified in flags | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 404 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 405 | # returns true if "s" is found, false otherwise | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 406 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 407 | 342 | ▶ | sub subdomain_flag { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
subdomain_flag: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 408 | 342 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 409 | 342 | my @flags = split /:/, $self->flags; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 410 | 342 | return grep { $_ eq 's' } @flags; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 411 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 412 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 413 | 0 | ▶ | sub revoked { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
revoked: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 414 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 415 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 416 | 0 | ▶ | $self->data | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 417 | or return 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 418 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 419 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 420 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 421 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 422 | 0 | ▶ | sub testing { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
testing: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 423 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 424 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 425 | 0 | my $flags = $self->flags; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 426 | 0 | my @flaglist = split( /:/, $flags ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 427 | 0 | ▶ | if ( grep { $_ eq 'y' } @flaglist ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 428 | 0 | return 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 429 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 430 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 431 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 432 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 433 | 0 | ▶ | sub verify_sha1_digest { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
verify_sha1_digest: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 434 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 435 | 0 | my ( $digest, $signature ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 436 | 0 | return $self->verify_digest( 'SHA-1', $digest, $signature ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 437 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 438 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 439 | 335 | ▶ | sub _verify_digest_rsa { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_verify_digest_rsa: called CC=5 SCAR=16.6
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 440 | 335 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 441 | 335 | my ( $digest_algorithm, $digest, $signature ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 442 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 443 | 335 | my $rsa_pub = $self->cork; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 444 | 335 | ▶ | if ( !$rsa_pub ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 445 | 0 | ▶ | $@ = $@ ne '' ? "RSA failed: $@" : 'RSA unknown problem'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 446 | 0 | $@ .= ", s=$self->{Selector} d=$self->{Domain}"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 447 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 448 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 449 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 450 | 335 | $rsa_pub->use_no_padding; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 451 | 335 | my $verify_result = $rsa_pub->encrypt($signature); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 452 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 453 | 327 | my $k = $rsa_pub->size; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 454 | 327 | my $expected = calculate_EM( $digest_algorithm, $digest, $k ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 455 | 327 | ▶ | return 1 if ( $verify_result eq $expected ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 456 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 457 | # well, the RSA verification failed; I wonder if the RSA signing | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 458 | # was performed on a different digest value? I think we can check... | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 459 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 460 | # basically, if the $verify_result has the same prefix as $expected, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 461 | # then only the digest was different | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 462 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 463 | 52 | my $digest_len = length $digest; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 464 | 52 | my $prefix_len = length($expected) - $digest_len; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 465 | 52 | ▶ | if ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 466 | substr( $verify_result, 0, $prefix_len ) eq | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 467 | substr( $expected, 0, $prefix_len ) ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 468 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 469 | 49 | $@ = 'message has been altered'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 470 | 49 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 471 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 472 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 473 | 3 | $@ = 'bad RSA signature'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 474 | 3 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 475 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 476 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 477 | 3 | ▶ | sub _verify_digest_ed25519 { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_verify_digest_ed25519: called CC=4 SCAR=15.5
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 478 | 3 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 479 | 3 | my ( $digest_algorithm, $digest, $signature ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 480 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 481 | 3 | my $ed = $self->cork; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 482 | 3 | ▶ | if ( !$ed ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 483 | 0 | ▶ | $@ = $@ ne '' ? "Ed25519 failed: $@" : 'Ed25519 unknown problem'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 484 | 0 | $@ .= ", s=$self->{Selector} d=$self->{Domain}"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 485 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 486 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 487 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 488 | 3 | my $verify_result = $ed->verify_message($signature, $digest); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 489 | 3 | ▶ | return $verify_result if ($verify_result == 1); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 490 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 491 | 1 | $@ = 'bad Ed25519 signature'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 492 | 1 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 493 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 494 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 495 | # verify_digest() - returns true if the digest verifies, false otherwise | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 496 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 497 | # if false, $@ is set to a description of the problem | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 498 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 499 | 338 | ▶ | sub verify_digest { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
verify_digest: called CC=4 SCAR=14.3
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 500 | 338 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 501 | 338 | my ( $digest_algorithm, $digest, $signature ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 502 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 503 | 338 | ▶ | my $k_tag = $self->get_tag('k') || 'rsa'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$self->get_tag('k') || 'rsa'
MC/DC100%1/1
$self->get_tag('k') || 'rsa'
$self->get_tag('k')
Truth table100%2/2
A
A= $self->get_tag('k')
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 504 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 505 | 338 | ▶ | return $self->_verify_digest_rsa($digest_algorithm, $digest, $signature) if $k_tag eq 'rsa'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 506 | 3 | ▶ | return $self->_verify_digest_ed25519($digest_algorithm, $digest, $signature) if $k_tag eq 'ed25519'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 507 | 0 | $@ = 'unsupported key type'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 508 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 509 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 510 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 511 | 20 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 512 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 513 | __END__ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||