Пример #1
0
 /**
  * Initialize from ASN.1.
  *
  * @param Sequence $seq
  * @return self
  */
 public static function fromASN1(Sequence $seq)
 {
     $extensions = array_map(function (UnspecifiedType $el) {
         return Extension::fromASN1($el->asSequence());
     }, $seq->elements());
     return new self(...$extensions);
 }
Пример #2
0
 /**
  * Initialize from ASN.1.
  *
  * @param Sequence $seq
  * @return self
  */
 public static function fromASN1(Sequence $seq)
 {
     $targets = array_map(function (UnspecifiedType $el) {
         return Target::fromASN1($el->asTagged());
     }, $seq->elements());
     return new self(...$targets);
 }
Пример #3
0
 /**
  * Initialize from ASN.1.
  *
  * @param Sequence $seq
  * @return self
  */
 public static function fromASN1(Sequence $seq)
 {
     $subtrees = array_map(function (UnspecifiedType $el) {
         return GeneralSubtree::fromASN1($el->asSequence());
     }, $seq->elements());
     if (!count($subtrees)) {
         throw new \UnexpectedValueException("GeneralSubtrees must contain at least one GeneralSubtree.");
     }
     return new self(...$subtrees);
 }
Пример #4
0
 /**
  * Initialize from ASN.1.
  *
  * @param Sequence $seq
  * @return self
  */
 public static function fromASN1(Sequence $seq)
 {
     $attribs = array_map(function (UnspecifiedType $el) {
         return Attribute::fromASN1($el->asSequence());
     }, $seq->elements());
     // cast attributes
     $attribs = array_map(function (Attribute $attr) {
         $oid = $attr->oid();
         if (array_key_exists($oid, self::MAP_OID_TO_CLASS)) {
             $cls = self::MAP_OID_TO_CLASS[$oid];
             $attr = $attr->castValues($cls);
         }
         return $attr;
     }, $attribs);
     return new self(...$attribs);
 }