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();
if (strlen($content)) {
$newcontent = $this->_decode_ber($content, $start);
$length = $newcontent['length'];
$remainingLength = $length;
while ($remainingLength) {
$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") {
$length+= 2;
$start+= $length;
$newcontent[] = $temp;
break;
}
$start+= $length;
$newcontent = array($newcontent);
$remainingLength-= $length;
$newcontent[] = $temp;
$this->_string_shift($content, $length);
}
return array(