Пример #1
0
 /**
  * Get ASN.1 structure.
  *
  * @return Sequence
  */
 public function toASN1()
 {
     $elements = array(new Integer($this->_version), $this->_holder->toASN1(), $this->_issuer->toASN1(), $this->signature()->toASN1(), new Integer($this->serialNumber()), $this->_attrCertValidityPeriod->toASN1(), $this->_attributes->toASN1());
     if (isset($this->_issuerUniqueID)) {
         $elements[] = $this->_issuerUniqueID->toASN1();
     }
     if (count($this->_extensions)) {
         $elements[] = $this->_extensions->toASN1();
     }
     return new Sequence(...$elements);
 }
Пример #2
0
 /**
  *
  * @see \X501\ASN1\AttributeValue\AttributeValue::toASN1()
  * @return Sequence
  */
 public function toASN1()
 {
     return $this->_extensions->toASN1();
 }
Пример #3
0
 /**
  * Generate ASN.1 structure.
  *
  * @return Sequence
  */
 public function toASN1()
 {
     $elements = array();
     $version = $this->version();
     // if version is not default
     if ($version != self::VERSION_1) {
         $elements[] = new ExplicitlyTaggedType(0, new Integer($version));
     }
     $serial = $this->serialNumber();
     $signature = $this->signature();
     // add required elements
     array_push($elements, new Integer($serial), $signature->toASN1(), $this->_issuer->toASN1(), $this->_validity->toASN1(), $this->_subject->toASN1(), $this->_subjectPublicKeyInfo->toASN1());
     if (isset($this->_issuerUniqueID)) {
         $elements[] = new ImplicitlyTaggedType(1, $this->_issuerUniqueID->toASN1());
     }
     if (isset($this->_subjectUniqueID)) {
         $elements[] = new ImplicitlyTaggedType(2, $this->_subjectUniqueID->toASN1());
     }
     if (count($this->_extensions)) {
         $elements[] = new ExplicitlyTaggedType(3, $this->_extensions->toASN1());
     }
     return new Sequence(...$elements);
 }