line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Net::ACME2::Challenge::dns_01; |
2
|
|
|
|
|
|
|
|
3
|
3
|
|
|
3
|
|
18
|
use strict; |
|
3
|
|
|
|
|
4
|
|
|
3
|
|
|
|
|
82
|
|
4
|
3
|
|
|
3
|
|
14
|
use warnings; |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
71
|
|
5
|
|
|
|
|
|
|
|
6
|
3
|
|
|
3
|
|
11
|
use parent qw( Net::ACME2::Challenge ); |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
23
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
=encoding utf-8 |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
=head1 NAME |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
Net::ACME2::Challenge::dns_01 |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
=head1 DESCRIPTION |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
This module is instantiated by L and is a |
17
|
|
|
|
|
|
|
subclass of L. |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
=head1 METHODS |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
=head2 I->get_record_name() |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
Returns the name (i.e., just the leftmost label) of the TXT record to create. |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
(NB: This is always the same name, as per the ACME specification.) |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
=cut |
28
|
|
|
|
|
|
|
|
29
|
3
|
|
|
3
|
|
211
|
use constant get_record_name => '_acme-challenge'; |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
432
|
|
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
#---------------------------------------------------------------------- |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
=head2 I->get_record_value( $ACME ) |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
Accepts a L instance and returns the value of the TXT record |
36
|
|
|
|
|
|
|
to create. |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
Example: |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
X_XMlEGlxkmqi3B8IFROXLXogCSMGo0JUC9-cJ3Y1NY |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
=cut |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
sub get_record_value { |
45
|
0
|
|
|
0
|
1
|
|
my ($self, $acme) = @_; |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
# Errors for the programmer. |
48
|
0
|
0
|
|
|
|
|
if (!$acme) { |
49
|
0
|
|
|
|
|
|
die 'Need “Net::ACME2” instance to compute DNS record value!' |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
# NB: These are probably loaded anyway. |
53
|
0
|
|
|
|
|
|
require Digest::SHA; |
54
|
0
|
|
|
|
|
|
require MIME::Base64; |
55
|
|
|
|
|
|
|
|
56
|
0
|
|
|
|
|
|
my $key_authz = $acme->make_key_authorization($self); |
57
|
|
|
|
|
|
|
|
58
|
0
|
|
|
|
|
|
my $sha = Digest::SHA::sha256($key_authz); |
59
|
|
|
|
|
|
|
|
60
|
0
|
|
|
|
|
|
return MIME::Base64::encode_base64url($sha); |
61
|
|
|
|
|
|
|
} |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
1; |