lib/AWS/Signature/V4/X509.pm

filter: Statementstmt 100% 127 / 127 Branchbran 90.0% 63 / 70 Conditioncond 88.6% 47 / 53 MC/DCmcdc 67.6% 23 / 34 Subroutinesub 100% 28 / 28 Podpod 80.0% 4 / 5 totaltotal 92.1% 292 / 317 CC 58 SCAR 16.5
CC
58
Cov
95%
_tlv
10.0
_cryptx_signer
8.0
_build__signer
8.0
CRAP 5.2
« blib/lib/AWS/Signature/V4/Checksum.pm ↑ Summary blib/lib/AWS/Signature/V4/Error.pm »
1 package AWS::Signature::V4::X509;
2 9 ▶use v5.24;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 9 ▶use experimental qw< signatures >;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 9 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 9 ▶use MIME::Base64 qw< encode_base64 decode_base64 >;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 9 ▶use Math::BigInt;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 9 ▶use AWS::Signature::V4::Error qw< fail shown >;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 # a plain string or an arrayref of plain strings => arrayref
11 78 ▶sub _items ($value, $name) {
Subroutine _items: called CC=6 SCAR=17.9
12 78 ▶ $value = [$value] unless ref $value;
Branch: 1 branch
BranchTrueFalseTotal
unless ref $value 8 70 78
13 78 ▶ ref $value eq 'ARRAY'
Branch: 1 branch
BranchTrueFalseTotal
ref $value eq "ARRAY" or fail(400, "x509/$name must be a string or an array reference") 76 2 78
14 or fail 400, "x509/$name must be a string or an array reference";
15 76 for my $item ($value->@*) {
16 40 ▶ fail 400, "x509/$name must hold strings" if !defined $item || ref $item;
Branch: 1 branch
BranchTrueFalseTotal
if not defined $item or ref $item 4 36 40
Condition100%3/3
not defined $item or ref $item
l!l&&r!l&&!r
3136
MC/DC100%2/2
not defined $item or ref $item
not defined $item ref $item
Truth table100%3/3
not(A) or B
A= not defined $itemB= ref $item
ABresult
1X1
011
000
17 }
18 72 return $value;
19 }
20  
21 143 ▶sub _b64 ($der) { encode_base64($der, '') }
Subroutine _b64: called CC=1 SCAR=0.0
22  
23 # ---- X.509 helpers (no external dependencies) ------------------------------
24  
25 23 ▶sub _slurp ($file) {
Subroutine _slurp: called CC=2 SCAR=6.9
26 23 ▶ open my $fh, '<:raw', $file or fail 400, 'open(' . shown($file) . "): $!";
Branch: 1 branch
BranchTrueFalseTotal
open my $fh, "<:raw", $file or fail(400, 'open(' . shown($file) . "): $!") 21 2 23
27 21 local $/;
28 21 my $data = <$fh>;
29 21 close $fh;
30 21 return $data;
31 }
32  
33 28 ▶sub _to_ders ($cert) { # PEM bundles hold many certificates
Subroutine _to_ders: called CC=3 SCAR=11.0
34 28 ▶ return _check_der($cert) unless $cert =~ m{-----BEGIN};
Branch: 1 branch
BranchTrueFalseTotal
unless $cert =~ /-----BEGIN/u 11 17 28
35 17 my @ders = map { decode_base64($_) }
36 $cert =~ m{-----BEGIN CERTIFICATE-----(.*?)-----END CERTIFICATE-----}sg;
37 17 ▶ @ders or fail 400, 'no CERTIFICATE block in PEM';
Branch: 1 branch
BranchTrueFalseTotal
@ders or fail(400, "no CERTIFICATE block in PEM") 16 1 17
38 16 return map { _check_der($_) } @ders;
39 }
40  
41 61 ▶sub _to_der ($cert) {
Subroutine _to_der: called CC=3 SCAR=11.1
42 61 ▶ return _check_der($cert) unless $cert =~ m{-----BEGIN};
Branch: 1 branch
BranchTrueFalseTotal
unless $cert =~ /-----BEGIN/u 24 37 61
43 37 ▶ $cert =~ m{-----BEGIN CERTIFICATE-----(.*?)-----END CERTIFICATE-----}s
Branch: 1 branch
BranchTrueFalseTotal
$cert =~ /-----BEGIN CERTIFICATE-----(.*?)-----END CERTIFICATE-----/su or fail(400, "no CERTIFICATE block in PEM") 37 0 37
44 or fail 400, 'no CERTIFICATE block in PEM';
45 37 return _check_der(decode_base64($1));
46 }
47  
48 # a certificate is a DER SEQUENCE that fits exactly in the data
49 96 ▶sub _check_der ($der) {
Subroutine _check_der: called CC=3 SCAR=12.5
50 96 my ($tag, undef, $end) = _tlv($der, 0);
51 86 ▶ fail 400, 'not a DER-encoded certificate'
Branch: 1 branch
BranchTrueFalseTotal
unless $tag == 48 and $end == length $der 0 86 86
Condition33%1/3
$tag == 48 and $end == length $der
!ll&&!rl&&r
0086
MC/DC0%0/2
$tag == 48 and $end == length $der
$tag == 48 $end == length $der
Truth table33%1/3
A and B
A= $tag == 48B= $end == length $der
ABresult
0X0
100
111
52 unless $tag == 0x30 && $end == length $der;
53 86 return $der;
54 }
55  
56 # read one DER TLV at $off => (tag, content_start, content_end)
57 164 ▶sub _tlv ($der, $off) {
Subroutine _tlv: called CC=10 SCAR=23.1
58 164 my $max = length $der;
59 164 ▶ $off + 2 <= $max or fail 400, 'truncated certificate';
Branch: 1 branch
BranchTrueFalseTotal
$off + 2 <= $max or fail(400, "truncated certificate") 164 0 164
60 164 my $tag = ord substr $der, $off++, 1;
61 164 my $len = ord substr $der, $off++, 1;
62 164 ▶ if ($len & 0x80) { # long form, DER wants it minimal and definite
Branch: 1 branch
BranchTrueFalseTotal
if ($len & 128) 61 103 164
63 61 my $n = $len & 0x7F;
64 61 ▶ fail 400, 'not a DER-encoded certificate' if $n == 0 || $n > 4;
Branch: 1 branch
BranchTrueFalseTotal
if $n == 0 or $n > 4 4 57 61
Condition100%3/3
$n == 0 or $n > 4
l!l&&r!l&&!r
2257
MC/DC100%2/2
$n == 0 or $n > 4
$n == 0 $n > 4
Truth table100%3/3
A or B
A= $n == 0B= $n > 4
ABresult
1X1
011
000
65 57 ▶ $off + $n <= $max or fail 400, 'truncated certificate';
Branch: 1 branch
BranchTrueFalseTotal
$off + $n <= $max or fail(400, "truncated certificate") 56 1 57
66 56 $len = 0;
67 56 $len = ($len << 8) | ord substr($der, $off++, 1) for 1 .. $n;
68 56 ▶ fail 400, 'not a DER-encoded certificate'
Branch: 1 branch
BranchTrueFalseTotal
if $len < 128 or $len < 1 << 8 * ($n - 1) 4 52 56
Condition66%2/3
$len < 128 or $len < 1 << 8 * ($n - 1)
l!l&&r!l&&!r
4052
MC/DC50%1/2
$len < 128 or $len < 1 << 8 * ($n - 1)
$len < 128 $len < 1 << 8 * ($n - 1)
Truth table66%2/3
A or B
A= $len < 128B= $len < 1 << 8 * ($n - 1)
ABresult
1X1
011
000
69 if $len < 0x80 || $len < 1 << 8 * ($n - 1);
70 }
71 155 ▶ $off + $len <= $max or fail 400, 'truncated certificate';
Branch: 1 branch
BranchTrueFalseTotal
$off + $len <= $max or fail(400, "truncated certificate") 154 1 155
72 154 return ($tag, $off, $off + $len);
73 }
74  
75 # Certificate ::= SEQ { tbs SEQ { [0] version?, INTEGER serial, ... }, ... }
76 17 ▶sub _certificate_serial ($der) {
Subroutine _certificate_serial: called CC=3 SCAR=11.2
77 17 my (undef, $cs) = _tlv($der, 0);
78 17 my (undef, $ts) = _tlv($der, $cs);
79 17 my ($tag, $s, $e) = _tlv($der, $ts);
80 17 ▶ ($tag, $s, $e) = _tlv($der, $e) if $tag == 0xA0; # skip explicit version
Branch: 1 branch
BranchTrueFalseTotal
if $tag == 160 17 0 17
81 17 ▶ fail 400, 'cannot find certificate serial number' unless $tag == 0x02;
Branch: 1 branch
BranchTrueFalseTotal
unless $tag == 2 0 17 17
82 17 return Math::BigInt->from_hex(unpack 'H*', substr $der, $s, $e - $s)
83 ->bstr; # DER integers here are positive; leading 0x00 is harmless
84 }
85  
86 # The error of CryptX, without the location and the backtrace that Carp adds
87 # when verbose (the arguments in it may hold the password), escaped as caller
88 # input because it can hold the file name.
89 8 ▶sub _clean_error ($e) {
Subroutine _clean_error: called CC=1 SCAR=0.0
90 8 $e =~ s{\n\t.*}{}s; # the backtrace lines start with a tab
91 8 $e =~ s{\s+at \S+ line \d+\.?\s*\z}{};
92 8 return shown($e =~ s{\A\s+|\s+\z}{}gr);
93 }
94  
95 # $key is a file name or a scalar reference to the PEM text
96 23 ▶sub _cryptx_signer ($algo, $key, $password = undef) {
Subroutine _cryptx_signer: called CC=8 SCAR=20.8
97 23 ▶ my $class = $algo eq 'RSA' ? 'Crypt::PK::RSA' : 'Crypt::PK::ECC';
Branch: 1 branch
BranchTrueFalseTotal
$algo eq 'RSA' ? : 13 10 23
98 23 ▶ eval "require $class; 1" or fail 500, "cannot load $class";
Branch: 1 branch
BranchTrueFalseTotal
eval "require $class; 1" or fail(500, "cannot load $class") 23 0 23
99 23 ▶ my @args = ($key, defined $password ? ($password) : ());
Branch: 1 branch
BranchTrueFalseTotal
defined $password ? : 10 13 23
100 23 ▶ my $pk = eval {
Condition100%3/3
eval { do { local $Carp::Verbose = 0; local $Carp::MaxArgNums = -1; local $SIG{"__DIE__"}; $class->new(@args) } } // fail(400, 'cannot load the private key: ' . _clean_error($@))
l!l&&r!l&&!r
1517
MC/DC0%0/2
eval { do { local $Carp::Verbose = 0; local $Carp::MaxArgNums = -1; local $SIG{"__DIE__"}; $class->new(@args) } } // fail(400, 'cannot load the private key: ' . _clean_error($@))
eval { do { local $Carp::Verbose = 0; local $Carp::MaxArgNums = -1; local $SIG{"__DIE__"}; $class->new(@args) } } fail(400, 'cannot load the private key: ' . _clean_error($@))
Truth table33%1/3
A // B
A= eval { do { local $Carp::Verbose = 0; local $Carp::MaxArgNums = -1; local $SIG{"__DIE__"}; $class->new(@args) } }B= fail(400, 'cannot load the private key: ' . _clean_error($@))
ABresult
1X1
011
000
101 # no backtrace, e.g. from -MCarp=verbose or Carp::Always, with the password
102 23 local $Carp::Verbose = 0;
103 23 local $Carp::MaxArgNums = -1;
104 23 local $SIG{__DIE__};
105 23 $class->new(@args);
106 } // fail 400, "cannot load the private key: " . _clean_error($@);
107 15 ▶ fail 400, 'the key is not a private key' unless $pk->is_private;
Branch: 1 branch
BranchTrueFalseTotal
unless $pk->is_private 0 15 15
108 return $algo eq 'RSA'
109 ? sub ($bytes) { $pk->sign_message($bytes, 'SHA256', 'v1.5') }
110 15 ▶ : sub ($bytes) { $pk->sign_message($bytes, 'SHA256') };
Branch: 1 branch
BranchTrueFalseTotal
$algo eq 'RSA' ? : 7 8 15
111 }
112  
113 9 ▶use namespace::clean;
Subroutine BEGIN: called CC=1 SCAR=0.0
114  
115 # The certificate-based variant, as used by IAM Roles Anywhere. The options
116 # are the ones of the "x509" option of AWS::Signature::V4:
117 # certificate / certificate_file: PEM or DER text, or path of a file with it;
118 # only the first certificate of a PEM bundle is used
119 # chain / chain_files: optional arrayref of PEM/DER intermediate certificates,
120 # or of paths of files with them; a PEM item can be a bundle.
121 # chain can also be a plain string: a PEM-encoded bundle, and
122 # chain_files a plain string: the path of one file
123 # key_type: 'RSA' or 'ECDSA'
124 # serial: the serial number of the certificate, if it cannot be found
125 # signer: sub ($bytes_to_sign) -> raw signature bytes (DER for ECDSA,
126 # PKCS#1 v1.5 for RSA), computed with SHA-256; or, alternatively,
127 # private_key_file / private_key: PEM or DER key (path or content, the
128 # content wins), signed with CryptX; private_key_password if it
129 # is encrypted
130 9 has [qw<
131 key_type certificate certificate_file chain chain_files serial signer
132 private_key_file
133 >] => (is => 'ro');
134  
135 # the key text and its password are secrets, only needed to load the key:
136 # no public accessor, and they are dropped as soon as the key is loaded
137 has $_ => (is => 'ro', reader => "_$_", clearer => "_clear_$_")
138 9 for qw< private_key private_key_password >;
139  
140 # Derived from the options above. Lazy, so that each builder can use the
141 # others without depending on the order in which the constructor sets things
142 # up; BUILD forces them all, so that a bad certificate, chain or key is
143 # reported by new() and not by the first signature.
144 #
145 # **NOTE**: to add one, add its name here and write its builder.
146 9 my @DERIVED = qw< algorithm credential_id _chain _der _signer _type >;
147 9 has $_ => (is => 'lazy', init_arg => undef) for @DERIVED;
148  
149 82 ▶sub BUILD ($self, $args) {
Subroutine BUILD: called CC=3 SCAR=11.0
Pod undocumented
150 82 my %known = map { $_ => 1 } qw<
151 key_type certificate certificate_file chain chain_files serial signer
152 private_key_file private_key private_key_password
153 >;
154 82 ▶ if (my ($name) = sort(grep { !$known{$_} } keys $args->%*)) {
Branch: 1 branch
BranchTrueFalseTotal
if (my($name) = sort(grep({not $known{$_};} keys %$args))) 1 81 82
155 1 fail 400, 'unknown option "' . shown($name) . '" in x509';
156 }
157 81 for my $name (@DERIVED) { # not "for (...)": builders may use $_
158 394 $self->$name;
159 }
160  
161 # we don't need private key material past this point, so we get rid
162 # of it immediately. Of course it may still linger in memory depending
163 # on garbage collection.
164 45 $self->_clear_private_key;
165 45 $self->_clear_private_key_password;
166 45 return;
167 }
168  
169 81 ▶sub _build__type ($self) {
Subroutine _build__type: called CC=4 SCAR=13.9
170 81 ▶ my $type = uc($self->key_type // fail 400, 'missing x509/key_type');
Condition66%2/3
$self->key_type // fail(400, "missing x509/key_type")
l!l&&r!l&&!r
8010
MC/DC0%0/2
$self->key_type // fail(400, "missing x509/key_type")
$self->key_type fail(400, "missing x509/key_type")
Truth table33%1/3
A // B
A= $self->key_typeB= fail(400, "missing x509/key_type")
ABresult
1X1
011
000
171 80 ▶ fail 400, 'x509/key_type must be RSA or ECDSA, got ' . shown($type)
Branch: 1 branch
BranchTrueFalseTotal
unless $type eq "RSA" or $type eq "ECDSA" 3 77 80
Condition100%3/3
$type eq "RSA" or $type eq "ECDSA"
l!l&&r!l&&!r
46313
MC/DC100%2/2
$type eq "RSA" or $type eq "ECDSA"
$type eq "RSA" $type eq "ECDSA"
Truth table100%3/3
A or B
A= $type eq "RSA"B= $type eq "ECDSA"
ABresult
1X1
011
000
172 unless $type eq 'RSA' || $type eq 'ECDSA';
173 77 return $type;
174 }
175  
176 81 ▶sub _build_algorithm ($self) { 'AWS4-X509-' . $self->_type . '-SHA256' }
Subroutine _build_algorithm: called CC=1 SCAR=0.0
177  
178 63 ▶sub _build__der ($self) {
Subroutine _build__der: called CC=4 SCAR=13.9
179 63 my $cert = $self->certificate;
180 63 ▶ if (!defined $cert && defined $self->certificate_file) {
Branch: 1 branch
BranchTrueFalseTotal
if (not defined $cert and defined $self->certificate_file) 16 47 63
Condition100%3/3
not defined $cert and defined $self->certificate_file
!ll&&!rl&&r
46116
MC/DC100%2/2
not defined $cert and defined $self->certificate_file
not defined $cert defined $self->certificate_file
Truth table100%3/3
not(A) and B
A= not defined $certB= defined $self->certificate_file
ABresult
0X0
100
111
181 16 $cert = _slurp($self->certificate_file);
182 }
183 62 ▶ defined $cert or fail 400, 'x509 needs "certificate" or "certificate_file"';
Branch: 1 branch
BranchTrueFalseTotal
defined $cert or fail(400, "x509 needs \"certificate\" or \"certificate_file\"") 61 1 62
184 61 return _to_der($cert);
185 }
186  
187 75 ▶sub _build__chain ($self) {
Subroutine _build__chain: called CC=7 SCAR=19.5
188 75 my $chain = $self->chain;
189 75 ▶ if (!defined $chain && defined $self->chain_files) {
Branch: 1 branch
BranchTrueFalseTotal
if (not defined $chain and defined $self->chain_files) 8 67 75
Condition100%3/3
not defined $chain and defined $self->chain_files
!ll&&!rl&&r
24438
MC/DC100%2/2
not defined $chain and defined $self->chain_files
not defined $chain defined $self->chain_files
Truth table100%3/3
not(A) and B
A= not defined $chainB= defined $self->chain_files
ABresult
0X0
100
111
190 8 my $files = _items($self->chain_files, 'chain_files'); # a single path or an arrayref
191 6 $chain = [map { _slurp($_) } $files->@*];
192 }
193 72 ▶ if (defined $chain && !ref $chain) { # a plain string is a PEM bundle
Branch: 1 branch
BranchTrueFalseTotal
if (defined $chain and not ref $chain) 7 65 72
Condition100%3/3
defined $chain and not ref $chain
!ll&&!rl&&r
43227
MC/DC100%2/2
defined $chain and not ref $chain
defined $chain not ref $chain
Truth table100%3/3
A and not(B)
A= defined $chainB= not ref $chain
ABresult
0X0
100
111
194 7 ▶ $chain =~ m{-----BEGIN CERTIFICATE-----}
Branch: 1 branch
BranchTrueFalseTotal
$chain =~ /-----BEGIN CERTIFICATE-----/u or fail(400, "x509/chain as a string must be PEM-encoded") 5 2 7
195 or fail 400, 'x509/chain as a string must be PEM-encoded';
196 }
197 70 ▶ return [map { _to_ders($_) } _items($chain // [], 'chain')->@*];
Condition100%2/2
$chain // []
l!l
2743
MC/DC100%1/1
$chain // []
$chain
Truth table100%2/2
A
A= $chain
Aresult
11
00
198 }
199  
200 77 ▶sub _build_credential_id ($self) {
Subroutine _build_credential_id: called CC=2 SCAR=7.2
201 77 ▶ return $self->serial // _certificate_serial($self->_der);
Condition66%2/3
$self->serial // _certificate_serial($self->_der)
l!l&&r!l&&!r
58190
MC/DC0%0/2
$self->serial // _certificate_serial($self->_der)
$self->serial _certificate_serial($self->_der)
Truth table66%2/3
A // B
A= $self->serialB= _certificate_serial($self->_der)
ABresult
1X1
011
000
202 }
203  
204 55 ▶sub _build__signer ($self) {
Subroutine _build__signer: called CC=8 SCAR=20.8
205 55 my $type = $self->_type;
206 55 my $signer = $self->signer;
207 55 ▶ fail 400, '"signer" must be a code reference'
Branch: 1 branch
BranchTrueFalseTotal
if defined $signer and ref $signer ne "CODE" 1 54 55
Condition100%3/3
defined $signer and ref $signer ne "CODE"
!ll&&!rl&&r
24301
MC/DC100%2/2
defined $signer and ref $signer ne "CODE"
defined $signer ref $signer ne "CODE"
Truth table100%3/3
A and B
A= defined $signerB= ref $signer ne "CODE"
ABresult
0X0
100
111
208 if defined $signer && ref $signer ne 'CODE';
209 54 ▶ if (!$signer && defined $self->_private_key) { # the content wins, as for certificate
Branch: 2 branches
BranchTrueFalseTotal
if (not $signer and defined $self->_private_key) { } 13 41 54
elsif (not $signer and defined $self->private_key_file) { } 10 61 71
Condition100%3/3
not $signer and defined $self->_private_key
!ll&&!rl&&r
301113
MC/DC100%2/2
not $signer and defined $self->_private_key
not $signer defined $self->_private_key
Truth table100%3/3
not(A) and B
A= not $signerB= defined $self->_private_key
ABresult
0X0
100
111
210 13 my $key = $self->_private_key; # CryptX wants a reference for a PEM/DER text
211 13 $signer = _cryptx_signer($type, \$key, $self->_private_key_password);
212 }
213 ▶ elsif (!$signer && defined $self->private_key_file) {
Condition100%3/3
not $signer and defined $self->private_key_file
!ll&&!rl&&r
30110
MC/DC100%2/2
not $signer and defined $self->private_key_file
not $signer defined $self->private_key_file
Truth table100%3/3
not(A) and B
A= not $signerB= defined $self->private_key_file
ABresult
0X0
100
111
214 10 $signer = _cryptx_signer($type, $self->private_key_file, $self->_private_key_password);
215 }
216 46 ▶ return $signer
Condition66%2/3
$signer // fail(400, "x509 needs one of \"signer\", \"private_key_file\", \"private_key\"")
l!l&&r!l&&!r
4510
MC/DC0%0/2
$signer // fail(400, "x509 needs one of \"signer\", \"private_key_file\", \"private_key\"")
$signer fail(400, "x509 needs one of \"signer\", \"private_key_file\", \"private_key\"")
Truth table33%1/3
A // B
A= $signerB= fail(400, "x509 needs one of \"signer\", \"private_key_file\", \"private_key\"")
ABresult
1X1
011
000
217 // fail 400, 'x509 needs one of "signer", "private_key_file", "private_key"';
218 }
219  
220 # ---- what AWS::Signature::V4 wants from a variant --------------------------
221  
222 # hex signature of the string to sign; the scope is not used here
223 115 ▶sub signature ($self, $scope, $string_to_sign) {
Subroutine signature: called CC=5 SCAR=16.1
Pod documented
224 115 my $sig = $self->_signer->($string_to_sign);
225 115 ▶ fail 400, 'the x509 signer returned no signature'
Branch: 1 branch
BranchTrueFalseTotal
unless defined $sig and not ref $sig and length $sig 4 111 115
Condition100%6/6
defined $sig and not ref $sig and length $sig
!ll&&!rl&&r
31111
defined $sig and not ref $sig
!ll&&!rl&&r
21112
MC/DC100%3/3
defined $sig and not ref $sig and length $sig
defined $sig not ref $sig length $sig
Truth table100%4/4
A and not(B) and C
A= defined $sigB= not ref $sigC= length $sig
ABCresult
0XX0
10X0
1100
1111
226 unless defined $sig && !ref $sig && length $sig;
227 111 ▶ utf8::downgrade($sig, 1)
Branch: 1 branch
BranchTrueFalseTotal
utf8::downgrade($sig, 1) or fail(400, "the x509 signer returned a string with wide characters") 110 1 111
228 or fail 400, 'the x509 signer returned a string with wide characters';
229 110 return unpack 'H*', $sig;
230 }
231  
232 # what goes with the request besides the signature, as (name => value) pairs
233 112 ▶sub extra_fields ($self) {
Subroutine extra_fields: called CC=2 SCAR=6.9
Pod documented
234 112 my $chain = $self->_chain;
235 return (
236 'X-Amz-X509' => _b64($self->_der),
237 112 ▶ ($chain->@* ? ('X-Amz-X509-Chain' => join ',', map { _b64($_) } $chain->@*) : ()),
Branch: 1 branch
BranchTrueFalseTotal
@$chain ? : 18 94 112
238 );
239 }
240  
241 # No derived key, so no signed chunks. This is stated twice, on purpose:
242 # AWS::Signature::V4 asks can_sign_chunks() up front, to refuse the request
243 # before doing anything else, and signing_key() is what fails if somebody
244 # asks for the key anyway. If this ever changes, change BOTH, and the
245 # corresponding tests in t/variants.t.
246 3 ▶sub can_sign_chunks ($self) { 0 }
Subroutine can_sign_chunks: called CC=1 SCAR=0.0
Pod documented
247 1 ▶sub signing_key ($self, $scope) {
Subroutine signing_key: called CC=1 SCAR=0.0
Pod documented
248 1 fail 400, 'signed streaming needs the credentials variant, not x509';
249 }
250  
251 9 1;
« blib/lib/AWS/Signature/V4/Checksum.pm ↑ Summary blib/lib/AWS/Signature/V4/Error.pm »