line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Net::DNS::RR::TLSA; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
13
|
use strict; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
63
|
|
4
|
2
|
|
|
2
|
|
11
|
use warnings; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
92
|
|
5
|
|
|
|
|
|
|
our $VERSION = (qw$Id: TLSA.pm 1896 2023-01-30 12:59:25Z willem $)[2]; |
6
|
|
|
|
|
|
|
|
7
|
2
|
|
|
2
|
|
10
|
use base qw(Net::DNS::RR); |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
166
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
=head1 NAME |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
Net::DNS::RR::TLSA - DNS TLSA resource record |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
=cut |
15
|
|
|
|
|
|
|
|
16
|
2
|
|
|
2
|
|
13
|
use integer; |
|
2
|
|
|
|
|
9
|
|
|
2
|
|
|
|
|
10
|
|
17
|
|
|
|
|
|
|
|
18
|
2
|
|
|
2
|
|
82
|
use Carp; |
|
2
|
|
|
|
|
8
|
|
|
2
|
|
|
|
|
170
|
|
19
|
2
|
|
|
2
|
|
18
|
use constant BABBLE => defined eval { require Digest::BubbleBabble }; |
|
2
|
|
|
|
|
11
|
|
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
899
|
|
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
sub _decode_rdata { ## decode rdata from wire-format octet string |
23
|
13
|
|
|
13
|
|
36
|
my ( $self, $data, $offset ) = @_; |
24
|
|
|
|
|
|
|
|
25
|
13
|
|
|
|
|
29
|
my $next = $offset + $self->{rdlength}; |
26
|
|
|
|
|
|
|
|
27
|
13
|
|
|
|
|
54
|
@{$self}{qw(usage selector matchingtype)} = unpack "\@$offset C3", $$data; |
|
13
|
|
|
|
|
48
|
|
28
|
13
|
|
|
|
|
28
|
$offset += 3; |
29
|
13
|
|
|
|
|
43
|
$self->{certbin} = substr $$data, $offset, $next - $offset; |
30
|
13
|
|
|
|
|
25
|
return; |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
sub _encode_rdata { ## encode rdata as wire-format octet string |
35
|
5
|
|
|
5
|
|
9
|
my $self = shift; |
36
|
|
|
|
|
|
|
|
37
|
5
|
|
|
|
|
7
|
return pack 'C3 a*', @{$self}{qw(usage selector matchingtype certbin)}; |
|
5
|
|
|
|
|
20
|
|
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
sub _format_rdata { ## format rdata portion of RR string. |
42
|
2
|
|
|
2
|
|
2
|
my $self = shift; |
43
|
|
|
|
|
|
|
|
44
|
2
|
|
|
|
|
5
|
$self->_annotation( $self->babble ) if BABBLE; |
45
|
2
|
|
|
|
|
5
|
my @cert = split /(\S{64})/, $self->cert; |
46
|
2
|
|
|
|
|
8
|
my @rdata = ( $self->usage, $self->selector, $self->matchingtype, @cert ); |
47
|
2
|
|
|
|
|
10
|
return @rdata; |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
sub _parse_rdata { ## populate RR from rdata in argument list |
52
|
1
|
|
|
1
|
|
4
|
my ( $self, @argument ) = @_; |
53
|
|
|
|
|
|
|
|
54
|
1
|
|
|
|
|
2
|
for (qw(usage selector matchingtype)) { $self->$_( shift @argument ) } |
|
3
|
|
|
|
|
9
|
|
55
|
1
|
|
|
|
|
4
|
$self->cert(@argument); |
56
|
1
|
|
|
|
|
3
|
return; |
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
sub usage { |
61
|
6
|
|
|
6
|
1
|
17
|
my ( $self, @value ) = @_; |
62
|
6
|
|
|
|
|
12
|
for (@value) { $self->{usage} = 0 + $_ } |
|
2
|
|
|
|
|
16
|
|
63
|
6
|
|
100
|
|
|
33
|
return $self->{usage} || 0; |
64
|
|
|
|
|
|
|
} |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
sub selector { |
68
|
6
|
|
|
6
|
1
|
1052
|
my ( $self, @value ) = @_; |
69
|
6
|
|
|
|
|
8
|
for (@value) { $self->{selector} = 0 + $_ } |
|
2
|
|
|
|
|
5
|
|
70
|
6
|
|
100
|
|
|
69
|
return $self->{selector} || 0; |
71
|
|
|
|
|
|
|
} |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
sub matchingtype { |
75
|
6
|
|
|
6
|
1
|
1052
|
my ( $self, @value ) = @_; |
76
|
6
|
|
|
|
|
12
|
for (@value) { $self->{matchingtype} = 0 + $_ } |
|
2
|
|
|
|
|
6
|
|
77
|
6
|
|
100
|
|
|
26
|
return $self->{matchingtype} || 0; |
78
|
|
|
|
|
|
|
} |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
sub cert { |
82
|
7
|
|
|
7
|
1
|
15
|
my ( $self, @value ) = @_; |
83
|
7
|
100
|
|
|
|
19
|
return unpack "H*", $self->certbin() unless scalar @value; |
84
|
3
|
100
|
|
|
|
6
|
my @hex = map { /^"*([\dA-Fa-f]*)"*$/ || croak("corrupt hex"); $1 } @value; |
|
4
|
|
|
|
|
261
|
|
|
3
|
|
|
|
|
11
|
|
85
|
2
|
|
|
|
|
18
|
return $self->certbin( pack "H*", join "", @hex ); |
86
|
|
|
|
|
|
|
} |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
sub certbin { |
90
|
12
|
|
|
12
|
1
|
681
|
my ( $self, @value ) = @_; |
91
|
12
|
|
|
|
|
21
|
for (@value) { $self->{certbin} = $_ } |
|
2
|
|
|
|
|
5
|
|
92
|
12
|
|
100
|
|
|
79
|
return $self->{certbin} || ""; |
93
|
|
|
|
|
|
|
} |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
|
96
|
4
|
|
|
4
|
1
|
1463
|
sub certificate { return &cert; } |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
sub babble { |
100
|
4
|
|
|
4
|
1
|
1082
|
return BABBLE ? Digest::BubbleBabble::bubblebabble( Digest => shift->certbin ) : ''; |
101
|
|
|
|
|
|
|
} |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
1; |
105
|
|
|
|
|
|
|
__END__ |