Debian Codegraph @

lib/3rdParty/composer/spomky-labs/pki-framework/src/X509/GeneralName/EDIPartyName.php

raw symbols SCIP
1 <?php
2
3 declare(strict_types=1);
4
5 namespace SpomkyLabs\Pki\X509\GeneralName;
6
7 use SpomkyLabs\Pki\ASN1\Type\Constructed\Sequence;
8 use SpomkyLabs\Pki\ASN1\Type\Tagged\ImplicitlyTaggedType;
9 use SpomkyLabs\Pki\ASN1\Type\TaggedType;
10 use SpomkyLabs\Pki\ASN1\Type\UnspecifiedType;
11
12 /**
13 * Implements *ediPartyName* CHOICE type of *GeneralName*.
14 *
15 * Currently acts as a parking object for decoding.
16 *
17 * @see https://tools.ietf.org/html/rfc5280#section-4.2.1.6
18 *
19 * @todo Implement EDIPartyName type
20 */
21 final class EDIPartyName extends GeneralName
22 {
23 private function __construct(
24 protected Sequence $element
25 ) {
26 parent::__construct(self::TAG_EDI_PARTY_NAME);
27 }
28
29 public static function create(Sequence $element): self
30 {
31 return new self($element);
32 }
33
34 /**
35 * @return self
36 */
37 public static function fromChosenASN1(UnspecifiedType $el): GeneralName
38 {
39 return self::create($el->asSequence());
40 }
41
42 public function string(): string
43 {
44 return bin2hex($this->element->toDER());
45 }
46
47 protected function choiceASN1(): TaggedType
48 {
49 return ImplicitlyTaggedType::create($this->tag, $this->element);
50 }
51 }