mirror of
https://github.com/phpseclib/phpseclib.git
synced 2024-11-16 10:15:14 +00:00
- when the child is an optional CHOICE it needs to be explicit and not implicit
- make asn1map more accurate git-svn-id: http://phpseclib.svn.sourceforge.net/svnroot/phpseclib/trunk@219 21d32557-59b3-4da0-833f-c5933fad653e
This commit is contained in:
parent
5db0f88218
commit
5a4595ab56
@ -438,14 +438,15 @@ class File_ASN1 {
|
||||
*/
|
||||
function asn1map($decoded, $mapping, $idx = NULL)
|
||||
{
|
||||
if (isset($mapping['explicit'])) {
|
||||
$decoded = $decoded['content'][0];
|
||||
}
|
||||
|
||||
switch (true) {
|
||||
case $mapping['type'] == FILE_ASN1_TYPE_CHOICE:
|
||||
foreach ($mapping['children'] as $key => $option) {
|
||||
switch (true) {
|
||||
case isset($option['constant']) && $option['constant'] == $decoded['constant']:
|
||||
// $decoded['content'] is only an array if the type is constructed
|
||||
$value = is_array($decoded['content']) ? $this->asn1map($decoded['content'][0], $option) : $this->asn1map($decoded, $option);
|
||||
break;
|
||||
case !isset($option['constant']) && $option['type'] == $decoded['type']:
|
||||
$value = $this->asn1map($decoded, $option);
|
||||
}
|
||||
@ -463,10 +464,6 @@ class File_ASN1 {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (isset($mapping['explicit'])) {
|
||||
$decoded = $decoded['content'][0];
|
||||
}
|
||||
|
||||
if (isset($mapping['implicit'])) {
|
||||
$decoded['type'] = $mapping['type'];
|
||||
}
|
||||
@ -1131,4 +1128,3 @@ class File_ASN1 {
|
||||
return $substr;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -660,7 +660,7 @@ class File_X509 {
|
||||
'directoryName' => array(
|
||||
'constant' => 4,
|
||||
'optional' => true,
|
||||
'implicit' => true
|
||||
'explicit' => true
|
||||
) + $Name,
|
||||
'ediPartyName' => array(
|
||||
'constant' => 5,
|
||||
@ -734,7 +734,7 @@ class File_X509 {
|
||||
'distributionPoint' => array(
|
||||
'constant' => 0,
|
||||
'optional' => true,
|
||||
'implicit' => true
|
||||
'explicit' => true
|
||||
) + $DistributionPointName,
|
||||
'reasons' => array(
|
||||
'constant' => 1,
|
||||
|
Loading…
Reference in New Issue
Block a user