line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Crypt::Perl::X509::Extension::acmeValidation_v1; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
460
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
22
|
|
4
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
23
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
=encoding utf-8 |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
=head1 NAME |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
=head1 SYNOPSIS |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
See L 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. |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
=cut |
27
|
|
|
|
|
|
|
|
28
|
1
|
|
|
1
|
|
4
|
use parent qw( Crypt::Perl::X509::Extension ); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
4
|
|
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
|
|
|
|
|
122
|
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
|
|
|
1
|
|
50
|
}; |
|
1
|
|
|
|
|
2
|
|
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
my $str_len = 32; |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
sub new { |
50
|
6
|
|
|
6
|
0
|
23
|
my ($class, $octets) = @_; |
51
|
|
|
|
|
|
|
|
52
|
6
|
50
|
|
|
|
20
|
if ($str_len != length($octets)) { |
53
|
0
|
|
|
|
|
0
|
die sprintf( 'Must have %d bytes, not “%v.02x”!', $str_len, $octets ); |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
|
56
|
6
|
|
|
|
|
41
|
return bless \$octets, $class |
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
sub _encode_params { |
60
|
6
|
|
|
6
|
|
11
|
return ${ $_[0] }; |
|
6
|
|
|
|
|
19
|
|
61
|
|
|
|
|
|
|
} |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
1; |