/** * 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."); }
/** * * @see AttributeValue::fromASN1 * @param UnspecifiedType $el * @return self */ public static function fromASN1(UnspecifiedType $el) { $tag = $el->tag(); self::_tagToASN1Class($tag); return new static($el->asString()->string(), $tag); }