/** * 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); }
/** * * @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); }
/** * * @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); }
/** * 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); }
public function toASN1() { return new ExplicitlyTaggedType($this->_type, $this->_name->toASN1()); }
/** * 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; }