line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Crypt::Perl::X509::Extension::keyUsage; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
482
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
25
|
|
4
|
1
|
|
|
1
|
|
8
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
30
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
=encoding utf-8 |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
=head1 NAME |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
Crypt::Perl::X509::Extension::keyUsage |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
=head1 SYNOPSIS |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
my $usage_obj = Crypt::Perl::X509::Extension::keyUsage->new( |
15
|
|
|
|
|
|
|
qw( |
16
|
|
|
|
|
|
|
digitalSignature |
17
|
|
|
|
|
|
|
contentCommitment |
18
|
|
|
|
|
|
|
keyEncipherment |
19
|
|
|
|
|
|
|
dataEncipherment |
20
|
|
|
|
|
|
|
keyAgreement |
21
|
|
|
|
|
|
|
keyCertSign |
22
|
|
|
|
|
|
|
cRLSign |
23
|
|
|
|
|
|
|
encipherOnly |
24
|
|
|
|
|
|
|
decipherOnly |
25
|
|
|
|
|
|
|
) |
26
|
|
|
|
|
|
|
); |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
=head1 SEE ALSO |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
L |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
=cut |
33
|
|
|
|
|
|
|
|
34
|
1
|
|
|
1
|
|
5
|
use parent qw( Crypt::Perl::X509::Extension ); |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
4
|
|
35
|
|
|
|
|
|
|
|
36
|
1
|
|
|
1
|
|
459
|
use Crypt::Perl::ASN1::BitString (); |
|
1
|
|
|
|
|
10
|
|
|
1
|
|
|
|
|
19
|
|
37
|
1
|
|
|
1
|
|
7
|
use Crypt::Perl::X (); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
16
|
|
38
|
|
|
|
|
|
|
|
39
|
1
|
|
|
1
|
|
5
|
use constant OID => '2.5.29.15'; |
|
1
|
|
|
|
|
5
|
|
|
1
|
|
|
|
|
52
|
|
40
|
|
|
|
|
|
|
|
41
|
1
|
|
|
1
|
|
5
|
use constant ASN1 => <
|
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
41
|
|
42
|
|
|
|
|
|
|
keyUsage ::= BIT STRING |
43
|
|
|
|
|
|
|
END |
44
|
|
|
|
|
|
|
|
45
|
1
|
|
|
1
|
|
5
|
use constant CRITICAL => 1; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
212
|
|
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
#The original bit values are “little-endian”. |
48
|
|
|
|
|
|
|
#We might as well transmogrify these values for ease of use here. |
49
|
|
|
|
|
|
|
my @_bits = qw( |
50
|
|
|
|
|
|
|
digitalSignature |
51
|
|
|
|
|
|
|
contentCommitment |
52
|
|
|
|
|
|
|
keyEncipherment |
53
|
|
|
|
|
|
|
dataEncipherment |
54
|
|
|
|
|
|
|
keyAgreement |
55
|
|
|
|
|
|
|
keyCertSign |
56
|
|
|
|
|
|
|
cRLSign |
57
|
|
|
|
|
|
|
encipherOnly |
58
|
|
|
|
|
|
|
decipherOnly |
59
|
|
|
|
|
|
|
); |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
sub new { |
62
|
6
|
|
|
6
|
0
|
38
|
my ($class, @usages) = @_; |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
#Use the modern name |
65
|
6
|
|
|
|
|
38
|
$_ =~ s<\AnonRepudiation\z> for @usages; |
66
|
|
|
|
|
|
|
|
67
|
6
|
50
|
|
|
|
24
|
if (!@usages) { |
68
|
0
|
|
|
|
|
0
|
die Crypt::Perl::X::create('Generic', 'Need usages!'); |
69
|
|
|
|
|
|
|
} |
70
|
|
|
|
|
|
|
|
71
|
6
|
|
|
|
|
41
|
return bless \@usages, $class; |
72
|
|
|
|
|
|
|
} |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
sub _encode_params { |
75
|
6
|
|
|
6
|
|
19
|
my ($self) = @_; |
76
|
|
|
|
|
|
|
|
77
|
6
|
|
|
|
|
40
|
return Crypt::Perl::ASN1::BitString::encode( \@_bits, [ @$self ] ); |
78
|
|
|
|
|
|
|
} |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
1; |