mirror of
https://github.com/phpseclib/phpseclib.git
synced 2024-12-26 11:37:33 +00:00
- BMPString's should be decoded via decodeBER(), use UTF8 strings for everything but policy qualifiers and make policy qualifiers optional
git-svn-id: http://phpseclib.svn.sourceforge.net/svnroot/phpseclib/trunk@207 21d32557-59b3-4da0-833f-c5933fad653e
This commit is contained in:
parent
5cc327e0c3
commit
42e5ad80f7
@ -408,6 +408,8 @@ class File_ASN1 {
|
||||
case FILE_ASN1_TYPE_GENERAL_STRING:
|
||||
// All registered C and G sets, space and delete
|
||||
case FILE_ASN1_TYPE_UTF8_STRING:
|
||||
// ????
|
||||
case FILE_ASN1_TYPE_BMP_STRING:
|
||||
$current['content'] = $content;
|
||||
break;
|
||||
case FILE_ASN1_TYPE_UTC_TIME:
|
||||
@ -733,6 +735,7 @@ class File_ASN1 {
|
||||
// ignore the min and max
|
||||
if (isset($mapping['min']) && isset($mapping['max'])) {
|
||||
$child = $mapping['children'];
|
||||
|
||||
foreach ($source as $content) {
|
||||
$temp = $this->_encode_der($content, $child);
|
||||
if ($temp === false) {
|
||||
|
@ -721,6 +721,7 @@ class File_X509 {
|
||||
'type' => FILE_ASN1_TYPE_SEQUENCE,
|
||||
'min' => 0,
|
||||
'max' => -1,
|
||||
'optional' => true,
|
||||
'children' => $PolicyQualifierInfo
|
||||
)
|
||||
)
|
||||
@ -1155,13 +1156,15 @@ class File_X509 {
|
||||
$filters['tbsCertificate']['subjectPublicKeyInfo']['algorithm']['parameters'] =
|
||||
$filters['signatureAlgorithm']['parameters'] =
|
||||
$filters['authorityCertIssuer']['directoryName']['rdnSequence']['value'] =
|
||||
$filters['policyQualifiers']['qualifier'] =
|
||||
//$filters['policyQualifiers']['qualifier'] =
|
||||
$filters['distributionPoint']['fullName']['directoryName']['rdnSequence']['value'] =
|
||||
$filters['directoryName']['rdnSequence']['value'] =
|
||||
array('type' => FILE_ASN1_TYPE_UTF8_STRING);
|
||||
/* in the case of policyQualifiers/qualifier, the type has to be FILE_ASN1_TYPE_IA5_STRING.
|
||||
FILE_ASN1_TYPE_PRINTABLE_STRING will cause OpenSSL's X.509 parser to spit out random
|
||||
characters.
|
||||
*/
|
||||
$filters['policyQualifiers']['qualifier'] =
|
||||
array('type' => FILE_ASN1_TYPE_IA5_STRING);
|
||||
|
||||
$asn1->loadFilters($filters);
|
||||
@ -1208,7 +1211,8 @@ class File_X509 {
|
||||
unset($cert['tbsCertificate']['extensions'][$i]);
|
||||
}
|
||||
} else {
|
||||
$value = base64_encode($asn1->encodeDER($value, $map));
|
||||
$temp = $asn1->encodeDER($value, $map);
|
||||
$value = base64_encode($temp);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user