lib/Crypt/Perl/X509/Extension/acmeValidation_v1.pm

filter: Statementstmt 95.0% 19 / 20 Branchbran 50.0% 1 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 6 / 6 Podpod 0.0% 0 / 1 totaltotal 89.6% 26 / 29 CC 2 SCAR 2.8
CC
2
Cov
91%
new
2.1
BEGIN
1.0
BEGIN
1.0
CRAP 1.3
« lib/Crypt/Perl/RSA/Parse.pm ↑ Summary lib/Crypt/Perl/ECDSA/EC/Curve.pm »
1 package Crypt::Perl::X509::Extension::acmeValidation_v1;
2  
3 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 =encoding utf-8
7  
8 =head1 NAME
9  
10 =head1 SYNOPSIS
11  
12 See L<Crypt::Perl::X509v3> for a more useful syntax for instantiating
13 this extension as part of certificate creation. The following is how
14 to instantiate it directly .. which isn’t very useful per se.
15  
16 my $extn = Crypt::Perl::X509::Extension::acmeValidation_v1->new(
17 $string_of_32_octets,
18 );
19  
20 =head1 DESCRIPTION
21  
22 This is the extension to use with the experimental ACME TLS ALPN
23 challenge, described at
24 L<https://datatracker.ietf.org/doc/draft-ietf-acme-tls-alpn/>.
25  
26 =cut
27  
28 1 ▶use parent qw( Crypt::Perl::X509::Extension );
Subroutine BEGIN: called CC=1 SCAR=0.0
29  
30 use constant {
31  
32 # https://www.ietf.org/rfc/rfc7299.txt
33 # id-pkix = 1.3.6.1.5.5.7
34 # id-pe = id-pkix 1
35 # id-pe-acmeIdentifier = id-pe 31
36 # id-pe-acmeIdentifier-v1 = id-pe-acmeIdentifier 1
37 #
38 1 OID => '1.3.6.1.5.5.7.1.30.1',
39  
40 CRITICAL => 1,
41  
42 # This results in an OCTET STRING that nests inside the extension’s
43 # own OCTET STRING. That seems to be what ACME wants.
44 ASN1 => 'acmeValidation_v1 ::= OCTET STRING',
45 1 ▶};
Subroutine BEGIN: called CC=1 SCAR=0.0
46  
47 1 my $str_len = 32;
48  
49 sub new {
50 6 ▶ my ($class, $octets) = @_;
Subroutine new: called CC=2 SCAR=7.6
Pod undocumented
51  
52 6 ▶ if ($str_len != length($octets)) {
Branch: 1 branch
BranchTrueFalseTotal
if ($str_len != length $octets) 0 6 6
53 0 die sprintf( 'Must have %d bytes, not “%v.02x”!', $str_len, $octets );
54 }
55  
56 6 return bless \$octets, $class
57 }
58  
59 sub _encode_params {
60 6 ▶ return ${ $_[0] };
Subroutine _encode_params: called CC=1 SCAR=0.0
61 }
62  
63 1 1;
« lib/Crypt/Perl/RSA/Parse.pm ↑ Summary lib/Crypt/Perl/ECDSA/EC/Curve.pm »