ASN1: constructed context-specific tags can have x sub elements

previously it only worked for when there was one sub element.
This commit is contained in:
terrafrost 2015-06-03 23:48:43 -05:00
parent e3d251ac57
commit d3a5398fe4

View File

@ -357,14 +357,21 @@ class File_ASN1
} }
$newcontent = array(); $newcontent = array();
if (strlen($content)) { $remainingLength = $length;
$newcontent = $this->_decode_ber($content, $start); while ($remainingLength) {
$length = $newcontent['length']; $temp = $this->_decode_ber($content, $start);
$length = $temp['length'];
// end-of-content octets - see paragraph 8.1.5
if (substr($content, $length, 2) == "\0\0") { if (substr($content, $length, 2) == "\0\0") {
$length+= 2; $length+= 2;
$start+= $length;
$newcontent[] = $temp;
break;
} }
$start+= $length; $start+= $length;
$newcontent = array($newcontent); $remainingLength-= $length;
$newcontent[] = $temp;
$this->_string_shift($content, $length);
} }
return array( return array(