line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Crypt::Perl::X509::Extension::nameConstraints; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
772
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
29
|
|
4
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
40
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
=encoding utf-8 |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
=head1 NAME |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
Crypt::Perl::X509::Extension::nameConstraints |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
=head1 SYNOPSIS |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
my $usage_obj = Crypt::Perl::X509::Extension::nameConstraints->new( |
15
|
|
|
|
|
|
|
permitted => [ |
16
|
|
|
|
|
|
|
[ dNSName => 'haha.tld', 1, 4 ], #min, max |
17
|
|
|
|
|
|
|
], |
18
|
|
|
|
|
|
|
excluded => [ |
19
|
|
|
|
|
|
|
[ dNSName => 'fofo.tld', 7 ], |
20
|
|
|
|
|
|
|
[ rfc822Name => 'haha@fofo.tld' ], |
21
|
|
|
|
|
|
|
], |
22
|
|
|
|
|
|
|
); |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
=head1 SEE ALSO |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
L |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
=cut |
29
|
|
|
|
|
|
|
|
30
|
1
|
|
|
1
|
|
5
|
use parent qw( Crypt::Perl::X509::Extension ); |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
9
|
|
31
|
|
|
|
|
|
|
|
32
|
1
|
|
|
1
|
|
60
|
use Crypt::Perl::X509::GeneralName (); |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
18
|
|
33
|
|
|
|
|
|
|
|
34
|
1
|
|
|
1
|
|
4
|
use constant OID => '2.5.29.30'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
63
|
|
35
|
|
|
|
|
|
|
|
36
|
1
|
|
|
1
|
|
5
|
use constant CRITICAL => 1; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
78
|
|
37
|
|
|
|
|
|
|
|
38
|
1
|
|
|
1
|
|
6
|
use constant ASN1 => Crypt::Perl::X509::GeneralName::ASN1() . <
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
285
|
|
39
|
|
|
|
|
|
|
BaseDistance ::= INTEGER -- (0..MAX) |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
GeneralSubtree ::= SEQUENCE { |
42
|
|
|
|
|
|
|
base ANY, |
43
|
|
|
|
|
|
|
minimum [0] BaseDistance, -- DEFAULT 0, |
44
|
|
|
|
|
|
|
maximum [1] BaseDistance OPTIONAL |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
-- GeneralSubtrees ::= SEQUENCE SIZE (1..MAX) OF GeneralSubtree |
48
|
|
|
|
|
|
|
GeneralSubtrees ::= SEQUENCE OF GeneralSubtree |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
nameConstraints ::= SEQUENCE { |
51
|
|
|
|
|
|
|
permittedSubtrees [0] GeneralSubtrees OPTIONAL, |
52
|
|
|
|
|
|
|
excludedSubtrees [1] GeneralSubtrees OPTIONAL |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
END |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
sub new { |
58
|
6
|
|
|
6
|
0
|
39
|
my ($class, %opts) = @_; |
59
|
|
|
|
|
|
|
|
60
|
6
|
|
|
|
|
15
|
my %self; |
61
|
|
|
|
|
|
|
|
62
|
6
|
|
|
|
|
42
|
for my $k ( qw( permitted excluded ) ) { |
63
|
12
|
50
|
|
|
|
59
|
my $subtrees_ar = $opts{$k} or next; |
64
|
|
|
|
|
|
|
|
65
|
12
|
|
|
|
|
22
|
my @subtrees; |
66
|
|
|
|
|
|
|
|
67
|
12
|
|
|
|
|
29
|
for my $i ( @$subtrees_ar ) { |
68
|
|
|
|
|
|
|
my %i_cp = ( |
69
|
18
|
100
|
100
|
|
|
37
|
base => Crypt::Perl::X509::GeneralName->new( @{$i}[0, 1] )->encode(), |
|
18
|
|
|
|
|
84
|
|
70
|
|
|
|
|
|
|
minimum => $i->[2] || 0, |
71
|
|
|
|
|
|
|
(defined($i->[3]) ? ( maximum => $i->[3] ) : () ), |
72
|
|
|
|
|
|
|
); |
73
|
|
|
|
|
|
|
|
74
|
18
|
|
|
|
|
1831
|
push @subtrees, \%i_cp; |
75
|
|
|
|
|
|
|
} |
76
|
|
|
|
|
|
|
|
77
|
12
|
|
|
|
|
67
|
$self{"${k}Subtrees"} = \@subtrees; |
78
|
|
|
|
|
|
|
} |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
|
81
|
6
|
|
|
|
|
56
|
return bless \%self, $class; |
82
|
|
|
|
|
|
|
} |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
sub _encode_params { |
85
|
6
|
|
|
6
|
|
19
|
my ($self) = @_; |
86
|
|
|
|
|
|
|
|
87
|
6
|
|
|
|
|
42
|
return { %$self }; |
88
|
|
|
|
|
|
|
} |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
1; |