Debian Codegraph @

lib/3rdParty/composer/spomky-labs/pki-framework/src/X509/Certificate/Extension/AccessDescription/SubjectAccessDescription.php

raw symbols SCIP
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 * @see https://tools.ietf.org/html/rfc5280#section-4.2.2.2
12 */
13 final class SubjectAccessDescription extends AccessDescription
14 {
15 /**
16 * Access method OID's.
17 *
18 * @var string
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 * Initialize from ASN.1.
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 * Check whether access method is time stamping.
39 */
40 public function isTimeStampingMethod(): bool
41 {
42 return $this->accessMethod === self::OID_METHOD_TIME_STAMPING;
43 }
44
45 /**
46 * Check whether access method is CA repository.
47 */
48 public function isCARepositoryMethod(): bool
49 {
50 return $this->accessMethod === self::OID_METHOD_CA_REPOSITORY;
51 }
52 }