line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Crypt::Perl::X509::Extension::ct_precert_scts; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
447
|
use strict; |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
33
|
|
4
|
1
|
|
|
1
|
|
7
|
use warnings; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
43
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
=encoding utf-8 |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
=head1 NAME |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
Crypt::Perl::X509::Extension::ct_precert_scts - X.509 ct_precert_scts extension |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
=head1 SYNOPSIS |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
my $extn = Crypt::Perl::X509::Extension::ct_precert_scts->new( |
15
|
|
|
|
|
|
|
{ |
16
|
|
|
|
|
|
|
log_id => .., |
17
|
|
|
|
|
|
|
timestamp => .., |
18
|
|
|
|
|
|
|
extensions => [ .. ], |
19
|
|
|
|
|
|
|
signature_algorithm => '..', |
20
|
|
|
|
|
|
|
}, |
21
|
|
|
|
|
|
|
# .. |
22
|
|
|
|
|
|
|
); |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
=head1 DESCRIPTION |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
Instances of this class represent a C extension |
27
|
|
|
|
|
|
|
of an X.509 (SSL) certificate. |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
You probably don’t need to |
30
|
|
|
|
|
|
|
instantiate this class directly; see L |
31
|
|
|
|
|
|
|
and L for the way this module is meant to be used. |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
=head1 SEE ALSO |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
=over |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
=item * L |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
=item * L |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
=back |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
=cut |
44
|
|
|
|
|
|
|
|
45
|
1
|
|
|
|
|
5
|
use parent qw( |
46
|
|
|
|
|
|
|
Crypt::Perl::X509::Extension |
47
|
1
|
|
|
1
|
|
8
|
); |
|
1
|
|
|
|
|
2
|
|
48
|
|
|
|
|
|
|
|
49
|
1
|
|
|
1
|
|
455
|
use Crypt::Perl::X509::SCT (); |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
21
|
|
50
|
|
|
|
|
|
|
|
51
|
1
|
|
|
1
|
|
5
|
use constant OID => '1.3.6.1.4.1.11129.2.4.2'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
59
|
|
52
|
|
|
|
|
|
|
|
53
|
1
|
|
|
1
|
|
10
|
use constant ASN1 => <
|
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
277
|
|
54
|
|
|
|
|
|
|
ct_precert_scts ::= SignedCertificateTimestampList |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
SignedCertificateTimestampList ::= OCTET STRING |
57
|
|
|
|
|
|
|
END |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
sub new { |
60
|
6
|
|
|
6
|
0
|
31
|
my ($class, @sct_hrs) = @_; |
61
|
|
|
|
|
|
|
|
62
|
6
|
|
|
|
|
55
|
return bless \@sct_hrs, $class; |
63
|
|
|
|
|
|
|
} |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
sub _encode_params { |
66
|
6
|
|
|
6
|
|
18
|
my ($self) = @_; |
67
|
|
|
|
|
|
|
|
68
|
6
|
|
|
|
|
16
|
my @scts = map { Crypt::Perl::X509::SCT::encode(%$_) } @$self; |
|
12
|
|
|
|
|
89
|
|
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
# Prefix with length. |
71
|
6
|
|
|
|
|
39
|
_tls_length_encode($_) for @scts; |
72
|
|
|
|
|
|
|
|
73
|
6
|
|
|
|
|
21
|
my $list = join( q<>, @scts ); |
74
|
|
|
|
|
|
|
|
75
|
6
|
|
|
|
|
17
|
_tls_length_encode($list); |
76
|
|
|
|
|
|
|
} |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
sub _tls_length_encode { |
79
|
18
|
|
|
18
|
|
58
|
substr( $_[0], 0, 0, pack('n', length $_[0]) ); |
80
|
|
|
|
|
|
|
|
81
|
18
|
|
|
|
|
54
|
return $_[0]; |
82
|
|
|
|
|
|
|
} |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
1; |