示例#1
0
文件: RDN.php 项目: sop/x501
 /**
  * Initialize from ASN.1.
  *
  * @param Set $set
  * @return self
  */
 public static function fromASN1(Set $set)
 {
     $attribs = array_map(function (UnspecifiedType $el) {
         return AttributeTypeAndValue::fromASN1($el->asSequence());
     }, $set->elements());
     return new self(...$attribs);
 }
示例#2
0
文件: Attributes.php 项目: sop/x509
 /**
  * Initialize from ASN.1.
  *
  * @param Set $set
  * @return self
  */
 public static function fromASN1(Set $set)
 {
     $attribs = array_map(function (UnspecifiedType $el) {
         return Attribute::fromASN1($el->asSequence());
     }, $set->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];
             return $attr->castValues($cls);
         }
         return $attr;
     }, $attribs);
     return new self(...$attribs);
 }