| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Crypt::Bear::X509::TrustAnchors; |
|
2
|
|
|
|
|
|
|
$Crypt::Bear::X509::TrustAnchors::VERSION = '0.004'; |
|
3
|
3
|
|
|
3
|
|
221820
|
use strict; |
|
|
3
|
|
|
|
|
4
|
|
|
|
3
|
|
|
|
|
92
|
|
|
4
|
3
|
|
|
3
|
|
10
|
use warnings; |
|
|
3
|
|
|
|
|
5
|
|
|
|
3
|
|
|
|
|
143
|
|
|
5
|
|
|
|
|
|
|
|
|
6
|
3
|
|
|
3
|
|
693
|
use Crypt::Bear; |
|
|
3
|
|
|
|
|
6
|
|
|
|
3
|
|
|
|
|
76
|
|
|
7
|
3
|
|
|
3
|
|
729
|
use Crypt::Bear::X509::Certificate; |
|
|
3
|
|
|
|
|
5
|
|
|
|
3
|
|
|
|
|
73
|
|
|
8
|
3
|
|
|
3
|
|
12
|
use File::Spec; |
|
|
3
|
|
|
|
|
4
|
|
|
|
3
|
|
|
|
|
957
|
|
|
9
|
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
sub load_file { |
|
11
|
2
|
|
|
2
|
1
|
377761
|
my ($self, $filename) = @_; |
|
12
|
|
|
|
|
|
|
|
|
13
|
2
|
50
|
|
|
|
219
|
open my $fh, '<:crlf', $filename or die "Could not open certificate $filename: $!"; |
|
14
|
2
|
|
|
|
|
6
|
my $raw = do { local $/; <$fh> }; |
|
|
2
|
|
|
|
|
10
|
|
|
|
2
|
|
|
|
|
2511
|
|
|
15
|
2
|
|
|
|
|
150776
|
my (@items) = Crypt::Bear::PEM::pem_decode($raw); |
|
16
|
|
|
|
|
|
|
|
|
17
|
2
|
|
|
|
|
68
|
while (my ($banner, $content) = splice @items, 0, 2) { |
|
18
|
144
|
50
|
|
|
|
319
|
die "File $filename does not contain a certificate" unless $banner =~ /CERTIFICATE/; |
|
19
|
144
|
|
|
|
|
36448
|
my $cert = Crypt::Bear::X509::Certificate->new($content); |
|
20
|
144
|
|
|
|
|
862
|
$self->add($cert); |
|
21
|
|
|
|
|
|
|
} |
|
22
|
|
|
|
|
|
|
|
|
23
|
2
|
|
|
|
|
78
|
return $self; |
|
24
|
|
|
|
|
|
|
} |
|
25
|
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub load_dir { |
|
27
|
0
|
|
|
0
|
1
|
|
my ($self, $dirname, $pattern) = @_; |
|
28
|
|
|
|
|
|
|
|
|
29
|
0
|
|
0
|
|
|
|
$pattern //= qr/ \.pem | \.crt /x; |
|
30
|
|
|
|
|
|
|
|
|
31
|
0
|
0
|
|
|
|
|
opendir my $dh, $dirname or die "Could not open $dirname: $!"; |
|
32
|
0
|
|
|
|
|
|
for my $file (grep /($pattern)$/, readdir $dh) { |
|
33
|
0
|
|
|
|
|
|
my $filename = File::Spec->catfile($dirname, $file); |
|
34
|
0
|
|
|
|
|
|
$self->load_file($filename); |
|
35
|
|
|
|
|
|
|
} |
|
36
|
|
|
|
|
|
|
|
|
37
|
0
|
|
|
|
|
|
return $self; |
|
38
|
|
|
|
|
|
|
} |
|
39
|
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
1; |
|
41
|
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
# ABSTRACT: A set of trust anchors in BearSSL |
|
43
|
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
__END__ |