コード例 #1
0
ファイル: GeneralSubtree.php プロジェクト: sop/x509
 /**
  * Generate ASN.1 structure.
  *
  * @return Sequence
  */
 public function toASN1()
 {
     $elements = array($this->_base->toASN1());
     if (isset($this->_min) && $this->_min != 0) {
         $elements[] = new ImplicitlyTaggedType(0, new Integer($this->_min));
     }
     if (isset($this->_max)) {
         $elements[] = new ImplicitlyTaggedType(1, new Integer($this->_max));
     }
     return new Sequence(...$elements);
 }
コード例 #2
0
ファイル: SvceAuthInfo.php プロジェクト: sop/x509
 /**
  *
  * @see \X501\ASN1\AttributeValue\AttributeValue::toASN1()
  * @return Sequence
  */
 public function toASN1()
 {
     $elements = array($this->_service->toASN1(), $this->_ident->toASN1());
     if (isset($this->_authInfo)) {
         $elements[] = new OctetString($this->_authInfo);
     }
     return new Sequence(...$elements);
 }
コード例 #3
0
ファイル: RoleAttributeValue.php プロジェクト: sop/x509
 /**
  *
  * @see \X501\ASN1\AttributeValue\AttributeValue::toASN1()
  * @return Sequence
  */
 public function toASN1()
 {
     $elements = array();
     if (isset($this->_roleAuthority)) {
         $elements[] = new ImplicitlyTaggedType(0, $this->_roleAuthority->toASN1());
     }
     $elements[] = new ExplicitlyTaggedType(1, $this->_roleName->toASN1());
     return new Sequence(...$elements);
 }
コード例 #4
0
ファイル: GeneralNames.php プロジェクト: sop/x509
 /**
  * Initialize from ASN.1.
  *
  * @param Sequence $seq
  * @throws \UnexpectedValueException
  * @return self
  */
 public static function fromASN1(Sequence $seq)
 {
     if (!count($seq)) {
         throw new \UnexpectedValueException("GeneralNames must have at least one GeneralName.");
     }
     $names = array_map(function (UnspecifiedType $el) {
         return GeneralName::fromASN1($el->asTagged());
     }, $seq->elements());
     return new self(...$names);
 }
コード例 #5
0
ファイル: TargetGroup.php プロジェクト: sop/x509
 public function toASN1()
 {
     return new ExplicitlyTaggedType($this->_type, $this->_name->toASN1());
 }
コード例 #6
0
ファイル: GeneralName.php プロジェクト: sop/x509
 /**
  * Check whether GeneralName is equal to other.
  *
  * @param GeneralName $other GeneralName to compare to
  * @return boolean True if names are equal
  */
 public function equals(GeneralName $other)
 {
     if ($this->_tag != $other->_tag) {
         return false;
     }
     if ($this->_choiceASN1()->toDER() != $other->_choiceASN1()->toDER()) {
         return false;
     }
     return true;
 }