- md5
- c4633347282f76eba4d0c1490804d628
- sha1
- f4adf174667b326251758d0771aeead1270376c1
- sha256
- d432aa8ffaa0ef95d796e0e96abd4df84c3ad211ed50754b52bf6f96546e9666
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
<?php
declare(strict_types=1);
namespace SpomkyLabs\Pki\X509\AttributeCertificate\Attribute;
use LogicException;
use SpomkyLabs\Pki\ASN1\Element;
use SpomkyLabs\Pki\ASN1\Type\Constructed\Sequence;
use SpomkyLabs\Pki\ASN1\Type\Primitive\OctetString;
use SpomkyLabs\Pki\ASN1\Type\UnspecifiedType;
use SpomkyLabs\Pki\X501\ASN1\AttributeValue\AttributeValue;
use SpomkyLabs\Pki\X501\MatchingRule\BinaryMatch;
use SpomkyLabs\Pki\X501\MatchingRule\MatchingRule;
use SpomkyLabs\Pki\X509\GeneralName\GeneralName;
/**
* Base class implementing *SvceAuthInfo* ASN.1 type used by attribute certificate attribute values.
*
* @see https://tools.ietf.org/html/rfc5755#section-4.4.1
*/
abstract class SvceAuthInfo extends AttributeValue
{
protected function __construct(
string $oid,
private readonly GeneralName $service,
private readonly GeneralName $ident,
private readonly ?string $authInfo = null
) {
parent::__construct($oid);
}
abstract public static function fromASN1(UnspecifiedType $el): static;
/**
* Get service name.
*/
public function service(): GeneralName
{
return $this->service;
}
public function ident(): GeneralName
{
return $this->ident;
}
/**
* Check whether authentication info is present.
*/
public function hasAuthInfo(): bool
{
return isset($this->authInfo);
}
/**
* Get authentication info.
*/
public function authInfo(): string
{
if (! $this->hasAuthInfo()) {
throw new LogicException('authInfo not set.');
}
return $this->authInfo;
}
public function toASN1(): Element
{
$elements = [$this->service->toASN1(), $this->ident->toASN1()];
if (isset($this->authInfo)) {
$elements[] = OctetString::create($this->authInfo);
}
return Sequence::create(...$elements);
}
public function stringValue(): string
{
return '#' . bin2hex($this->toASN1()->toDER());
}
public function equalityMatchingRule(): MatchingRule
{
return new BinaryMatch();
}
public function rfc2253String(): string
{
return $this->stringValue();
}
protected function _transcodedString(): string
{
return $this->stringValue();
}
}
The same content is in 158 releases, Joomla 5.0.0-alpha1 to 6.3.0-alpha1. See them all, or every version of this file.