| 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 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 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 |
|
| 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 |
} |