-
Notifications
You must be signed in to change notification settings - Fork 35
Description
Description
Certificates such as the attached fail to parse the subjectAltName, and die.
In the triggering case, the Microsoft "User Principal Name", an "otherName" variant of "GeneralName" is not supported.
In fact, any otherName in the subjectAltName will fail to parse and die.
Expected behaviour
Certificate should parse subjectaltname and return the UPN string, as with the attached patch. otherNames should not cause subjectaltname to die.
The patch is written to easily allow for any future "otherName"s that turn up. They will parse, but depending on their content, may require ASN.1 definitions similar to the one included for the UPN OID. But at least they will no longer die, and any other names will be available..
Actual behaviour
subjectaltname() dies with "Unable to decode SubjectAltName"
Operating system and version
Not OS specfici.
Crypt::OpenSSL::X509 version
1.915
Perl version
5.8.8 and more recent (not Perl version-dependent)
OpenSSL version
Various, not OpenSSL version dependent.
Step by step guide to reproducing the issue
perl -MCrypt::OpenSSL::X509 -MData::Dumper \
-e'print Dumper( Crypt::OpenSSL::X509->new_from_file("upn-cert.pem")->subjectaltname)'
Unable to decode SubjectAltName: decode error at /usr/lib/perl5/site_perl/5.8.8/Convert/ASN1/_decode.pm line 253.With patch:
perl -MCrypt::OpenSSL::X509 -MData::Dumper \
-e'print Dumper( Crypt::OpenSSL::X509->new_from_file("upn-cert.pem")->subjectaltname)'
$VAR1 = [
{
'otherName' => {
'value' => {
'microsoftUPN' => '[email protected]'
},
'type' => '1.3.6.1.4.1.311.20.2.3'
}
}
];Supporting files: (remove the .txt extensions when downloading)
Crypt_OpenSSL_X509_subjectaltname.patch
upn-cert.pem