/** * Initialize from ASN.1. * * @param UnspecifiedType $el * @throws \UnexpectedValueException * @return self */ public static function fromASN1(UnspecifiedType $el) { switch ($el->tag()) { case Element::TYPE_OCTET_STRING: case Element::TYPE_UTF8_STRING: return new self($el->asString()->string(), $el->tag()); case Element::TYPE_OBJECT_IDENTIFIER: return new self($el->asObjectIdentifier()->oid(), $el->tag()); } throw new \UnexpectedValueException("Type " . Element::tagToName($el->tag()) . " not supported."); }
/** * * @param UnspecifiedType $el * @return self */ public static function fromChosenASN1(UnspecifiedType $el) { return new self($el->asObjectIdentifier()->oid()); }
protected static function _fromASN1Params(UnspecifiedType $params = null) { if (!isset($params)) { throw new \UnexpectedValueException("No parameters."); } $named_curve = $params->asObjectIdentifier()->oid(); return new self($named_curve); }