line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Crypt::Perl::X509::GeneralName; |
2
|
|
|
|
|
|
|
|
3
|
4
|
|
|
4
|
|
27
|
use strict; |
|
4
|
|
|
|
|
9
|
|
|
4
|
|
|
|
|
129
|
|
4
|
4
|
|
|
4
|
|
22
|
use warnings; |
|
4
|
|
|
|
|
58
|
|
|
4
|
|
|
|
|
129
|
|
5
|
|
|
|
|
|
|
|
6
|
4
|
|
|
4
|
|
899
|
use Crypt::Perl::X509::Name (); |
|
4
|
|
|
|
|
11
|
|
|
4
|
|
|
|
|
84
|
|
7
|
|
|
|
|
|
|
|
8
|
4
|
|
|
4
|
|
26
|
use parent qw( Crypt::Perl::ASN1::Encodee ); |
|
4
|
|
|
|
|
19
|
|
|
4
|
|
|
|
|
25
|
|
9
|
|
|
|
|
|
|
|
10
|
4
|
|
|
4
|
|
430
|
use constant ASN1 => Crypt::Perl::X509::Name::ASN1() . <
|
|
4
|
|
|
|
|
9
|
|
|
4
|
|
|
|
|
957
|
|
11
|
|
|
|
|
|
|
AnotherName ::= SEQUENCE { |
12
|
|
|
|
|
|
|
type OBJECT IDENTIFIER, |
13
|
|
|
|
|
|
|
value [0] EXPLICIT ANY |
14
|
|
|
|
|
|
|
} |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
EDIPartyName ::= SEQUENCE { |
17
|
|
|
|
|
|
|
nameAssigner [0] DirectoryString OPTIONAL, |
18
|
|
|
|
|
|
|
partyName [1] DirectoryString |
19
|
|
|
|
|
|
|
} |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
-- No support for “compound” values until there’s a use case |
22
|
|
|
|
|
|
|
-- that can verify functionality. (OpenSSL’s parse doesn’t know |
23
|
|
|
|
|
|
|
-- what to do with the compound values as of 1.0.1j.) |
24
|
|
|
|
|
|
|
GeneralName ::= CHOICE { |
25
|
|
|
|
|
|
|
-- otherName [0] AnotherName, |
26
|
|
|
|
|
|
|
rfc822Name [1] IA5String, |
27
|
|
|
|
|
|
|
dNSName [2] IA5String, |
28
|
|
|
|
|
|
|
-- x400Address [3] ORAddress, |
29
|
|
|
|
|
|
|
directoryName [4] EXPLICIT ANY, |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
-- I’ve not figured out how to get OpenSSL to create this, |
32
|
|
|
|
|
|
|
-- and OpenSSL 1.0.1j doesn’t parse output from the below correctly. |
33
|
|
|
|
|
|
|
-- ediPartyName [5] EDIPartyName, |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
uniformResourceIdentifier [6] IA5String, |
36
|
|
|
|
|
|
|
iPAddress [7] OCTET STRING, |
37
|
|
|
|
|
|
|
registeredID [8] OBJECT IDENTIFIER |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
END |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
sub new { |
42
|
140
|
|
|
140
|
0
|
439
|
my ($class, $type, $value) = @_; |
43
|
|
|
|
|
|
|
|
44
|
140
|
50
|
|
|
|
522
|
if ($type eq 'otherName') { |
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
45
|
0
|
|
|
|
|
0
|
$value = { |
46
|
|
|
|
|
|
|
type => $value->[0], |
47
|
|
|
|
|
|
|
value => $value->[1], |
48
|
|
|
|
|
|
|
}; |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
elsif ($type eq 'directoryName') { |
51
|
30
|
|
|
|
|
230
|
$value = Crypt::Perl::X509::Name->new(@$value)->encode(); |
52
|
|
|
|
|
|
|
#substr( $value, 0, 1 ) = "\xa4"; |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
elsif ($type eq 'ediPartyName') { |
55
|
0
|
|
|
|
|
0
|
$value = { %$value }; |
56
|
0
|
|
|
|
|
0
|
$_ = { utf8String => $_ } for values %$value; |
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
|
59
|
140
|
|
|
|
|
4590
|
return bless [ $type => $value ], $class; |
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
sub _encode_params { |
63
|
140
|
|
|
140
|
|
347
|
my ($self) = @_; |
64
|
|
|
|
|
|
|
|
65
|
140
|
|
|
|
|
587
|
return { @$self }; #“de-bless” |
66
|
|
|
|
|
|
|
} |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
1; |