| 1 |
<?php |
| 2 |
|
| 3 |
declare(strict_types=1); |
| 4 |
|
| 5 |
namespace SpomkyLabs\Pki\X509\Certificate\Extension\AccessDescription; |
| 6 |
|
| 7 |
use SpomkyLabs\Pki\ASN1\Type\Constructed\Sequence; |
| 8 |
use SpomkyLabs\Pki\X509\GeneralName\GeneralName; |
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
final class SubjectAccessDescription extends AccessDescription |
| 14 |
{ |
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
final public const OID_METHOD_TIME_STAMPING = '1.3.6.1.5.5.7.48.3'; |
| 21 |
|
| 22 |
final public const OID_METHOD_CA_REPOSITORY = '1.3.6.1.5.5.7.48.5'; |
| 23 |
|
| 24 |
public static function create(string $accessMethod, GeneralName $accessLocation): self |
| 25 |
{ |
| 26 |
return new self($accessMethod, $accessLocation); |
| 27 |
} |
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
|
| 32 |
public static function fromASN1(Sequence $seq): static |
| 33 |
{ |
| 34 |
return new static($seq->at(0)->asObjectIdentifier()->oid(), GeneralName::fromASN1($seq->at(1)->asTagged())); |
| 35 |
} |
| 36 |
|
| 37 |
|
| 38 |
|
| 39 |
|
| 40 |
public function isTimeStampingMethod(): bool |
| 41 |
{ |
| 42 |
return $this->accessMethod === self::OID_METHOD_TIME_STAMPING; |
| 43 |
} |
| 44 |
|
| 45 |
|
| 46 |
|
| 47 |
|
| 48 |
public function isCARepositoryMethod(): bool |
| 49 |
{ |
| 50 |
return $this->accessMethod === self::OID_METHOD_CA_REPOSITORY; |
| 51 |
} |
| 52 |
} |