Esempio n. 1
0
 /**
  * Initialize from ASN.1 with given OID hint.
  *
  * @param string $oid Attribute's OID
  * @param UnspecifiedType $el
  * @return self
  */
 public static function fromASN1ByOID($oid, UnspecifiedType $el)
 {
     if (!array_key_exists($oid, self::MAP_OID_TO_CLASS)) {
         return new UnknownAttributeValue($oid, $el->asElement());
     }
     $cls = self::MAP_OID_TO_CLASS[$oid];
     return $cls::fromASN1($el);
 }
 protected static function _fromASN1Params(UnspecifiedType $params = null)
 {
     $obj = new static();
     // store parameters so re-encoding doesn't change
     if (isset($params)) {
         $obj->_params = $params->asElement();
     }
     return $obj;
 }
 /**
  * Constructor
  *
  * @param string $oid Algorithm OID
  * @param UnspecifiedType|null $params Parameters
  */
 public function __construct($oid, UnspecifiedType $params = null)
 {
     $this->_oid = $oid;
     $this->_params = $params ? $params->asElement() : null;
 }