Example #1
0
File: Name.php Project: sop/x501
 /**
  * Initialize from ASN.1.
  *
  * @param Sequence $seq
  * @return self
  */
 public static function fromASN1(Sequence $seq)
 {
     $rdns = array_map(function (UnspecifiedType $el) {
         return RDN::fromASN1($el->asSet());
     }, $seq->elements());
     return new self(...$rdns);
 }
Example #2
0
 /**
  * Initialize from TaggedType.
  *
  * @param TaggedType $el
  * @throws \UnexpectedValueException
  * @return self
  */
 public static function fromTaggedType(TaggedType $el)
 {
     switch ($el->tag()) {
         case self::TAG_FULL_NAME:
             return new FullName(GeneralNames::fromASN1($el->asImplicit(Element::TYPE_SEQUENCE)->asSequence()));
         case self::TAG_RDN:
             return new RelativeName(RDN::fromASN1($el->asImplicit(Element::TYPE_SET)->asSet()));
         default:
             throw new \UnexpectedValueException("DistributionPointName tag " . $el->tag() . " not supported.");
     }
 }
Example #3
0
 protected function _valueASN1()
 {
     return $this->_rdn->toASN1();
 }