Esempio n. 1
0
File: DERData.php Progetto: sop/asn1
 /**
  * Constructor
  *
  * @param string $data DER encoded data
  * @throws DecodeException If data does not adhere to DER
  */
 public function __construct($data)
 {
     $this->_identifier = Identifier::fromDER($data, $this->_contentOffset);
     Length::expectFromDER($data, $this->_contentOffset);
     $this->_der = $data;
     $this->_typeTag = intval($this->_identifier->tag());
 }
Esempio n. 2
0
 /**
  * Constructor
  *
  * @param Identifier $identifier
  * @param string $data
  * @param int $offset Offset to next byte after identifier
  */
 public function __construct(Identifier $identifier, $data, $offset)
 {
     $this->_identifier = $identifier;
     $this->_data = $data;
     $this->_offset = $offset;
     $this->_typeTag = intval($identifier->tag());
 }
Esempio n. 3
0
File: Element.php Progetto: sop/asn1
 /**
  * Determine the class that implements the type.
  *
  * @param Identifier $identifier
  * @return string Class name
  */
 protected static function _determineImplClass(Identifier $identifier)
 {
     // tagged type
     if ($identifier->isContextSpecific()) {
         return TaggedType::class;
     }
     // universal class
     if ($identifier->isUniversal()) {
         return self::_determineUniversalImplClass(intval($identifier->tag()));
     }
     throw new \UnexpectedValueException(Identifier::classToName($identifier->typeClass()) . " " . $identifier->tag() . " not implemented.");
 }