Esempio n. 1
0
 /**
  *
  * @see \ASN1\Element::_decodeFromDER()
  * @return self
  */
 protected static function _decodeFromDER(Identifier $identifier, $data, &$offset)
 {
     $idx = $offset;
     if (!$identifier->isConstructed()) {
         throw new DecodeException("Structured element must have constructed bit set.");
     }
     $length = Length::expectFromDER($data, $idx);
     $end = $idx + $length->length();
     $elements = array();
     while ($idx < $end) {
         $elements[] = Element::fromDER($data, $idx);
         // check that element didn't overflow length
         if ($idx > $end) {
             throw new DecodeException("Structure's content overflows length.");
         }
     }
     $offset = $idx;
     // return instance by static late binding
     return new static(...$elements);
 }
Esempio n. 2
0
File: DERData.php Progetto: sop/asn1
 /**
  *
  * @see \ASN1\Element::isConstructed()
  * @return bool
  */
 public function isConstructed()
 {
     return $this->_identifier->isConstructed();
 }