diff --git a/phpseclib/File/ASN1.php b/phpseclib/File/ASN1.php index 56bf8787..f5a752c1 100644 --- a/phpseclib/File/ASN1.php +++ b/phpseclib/File/ASN1.php @@ -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; } } - diff --git a/phpseclib/File/X509.php b/phpseclib/File/X509.php index 12a079fa..57674516 100644 --- a/phpseclib/File/X509.php +++ b/phpseclib/File/X509.php @@ -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,