« blib/lib/Crypt/Perl/X509/Extension/extKeyUsage.pm
↑ Summary
blib/lib/Crypt/Perl/ECDSA/EC/FieldElement.pm »
| 1 | package Crypt::Perl::X509::GeneralName; | ||||||||||||||||||
| 2 | |||||||||||||||||||
| 3 | 4 | ▶ | use strict; | ||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||
| 4 | 4 | ▶ | use warnings; | ||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||
| 5 | |||||||||||||||||||
| 6 | 4 | ▶ | use Crypt::Perl::X509::Name (); | ||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||
| 7 | |||||||||||||||||||
| 8 | 4 | ▶ | use parent qw( Crypt::Perl::ASN1::Encodee ); | ||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||
| 9 | |||||||||||||||||||
| 10 | 4 | ▶ | use constant ASN1 => Crypt::Perl::X509::Name::ASN1() . <<END; | ||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||
| 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 | ▶ | my ($class, $type, $value) = @_; | ||||||||||||||||
|
Subroutine
new: called CC=5 SCAR=18.6
Pod
undocumented
| |||||||||||||||||||
| 43 | |||||||||||||||||||
| 44 | 140 | ▶ | if ($type eq 'otherName') { | ||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||
| 45 | 0 | $value = { | |||||||||||||||||
| 46 | type => $value->[0], | ||||||||||||||||||
| 47 | value => $value->[1], | ||||||||||||||||||
| 48 | }; | ||||||||||||||||||
| 49 | } | ||||||||||||||||||
| 50 | elsif ($type eq 'directoryName') { | ||||||||||||||||||
| 51 | 30 | $value = Crypt::Perl::X509::Name->new(@$value)->encode(); | |||||||||||||||||
| 52 | #substr( $value, 0, 1 ) = "\xa4"; | ||||||||||||||||||
| 53 | } | ||||||||||||||||||
| 54 | elsif ($type eq 'ediPartyName') { | ||||||||||||||||||
| 55 | 0 | $value = { %$value }; | |||||||||||||||||
| 56 | 0 | $_ = { utf8String => $_ } for values %$value; | |||||||||||||||||
| 57 | } | ||||||||||||||||||
| 58 | |||||||||||||||||||
| 59 | 140 | return bless [ $type => $value ], $class; | |||||||||||||||||
| 60 | } | ||||||||||||||||||
| 61 | |||||||||||||||||||
| 62 | sub _encode_params { | ||||||||||||||||||
| 63 | 140 | ▶ | my ($self) = @_; | ||||||||||||||||
|
Subroutine
_encode_params: called CC=1 SCAR=0.0
| |||||||||||||||||||
| 64 | |||||||||||||||||||
| 65 | 140 | return { @$self }; #“de-bless” | |||||||||||||||||
| 66 | } | ||||||||||||||||||
| 67 | |||||||||||||||||||
| 68 | 4 | 1; | |||||||||||||||||