line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Crypt::Perl::X509::GeneralName; |
2
|
|
|
|
|
|
|
|
3
|
4
|
|
|
4
|
|
38
|
use strict; |
|
4
|
|
|
|
|
11
|
|
|
4
|
|
|
|
|
110
|
|
4
|
4
|
|
|
4
|
|
20
|
use warnings; |
|
4
|
|
|
|
|
9
|
|
|
4
|
|
|
|
|
127
|
|
5
|
|
|
|
|
|
|
|
6
|
4
|
|
|
4
|
|
713
|
use Crypt::Perl::X509::Name (); |
|
4
|
|
|
|
|
11
|
|
|
4
|
|
|
|
|
90
|
|
7
|
|
|
|
|
|
|
|
8
|
4
|
|
|
4
|
|
22
|
use parent qw( Crypt::Perl::ASN1::Encodee ); |
|
4
|
|
|
|
|
10
|
|
|
4
|
|
|
|
|
20
|
|
9
|
|
|
|
|
|
|
|
10
|
4
|
|
|
4
|
|
459
|
use constant ASN1 => Crypt::Perl::X509::Name::ASN1() . <
|
|
4
|
|
|
|
|
9
|
|
|
4
|
|
|
|
|
929
|
|
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
|
406
|
my ($class, $type, $value) = @_; |
43
|
|
|
|
|
|
|
|
44
|
140
|
50
|
|
|
|
638
|
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
|
|
|
|
|
284
|
$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
|
|
|
|
|
4001
|
return bless [ $type => $value ], $class; |
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
sub _encode_params { |
63
|
140
|
|
|
140
|
|
374
|
my ($self) = @_; |
64
|
|
|
|
|
|
|
|
65
|
140
|
|
|
|
|
614
|
return { @$self }; #“de-bless” |
66
|
|
|
|
|
|
|
} |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
1; |