<?php
 declare(strict_types=1); namespace SpomkyLabs\Pki\X509\GeneralName; use SpomkyLabs\Pki\ASN1\Type\Primitive\ObjectIdentifier; use SpomkyLabs\Pki\ASN1\Type\Tagged\ImplicitlyTaggedType; use SpomkyLabs\Pki\ASN1\Type\TaggedType; use SpomkyLabs\Pki\ASN1\Type\UnspecifiedType; final class RegisteredID extends GeneralName { private function __construct( private readonly string $oid ) { parent::__construct(self::TAG_REGISTERED_ID); } public static function create(string $oid): self { return new self($oid); } public static function fromChosenASN1(UnspecifiedType $el): GeneralName { return self::create($el->asObjectIdentifier()->oid()); } public function string(): string { return $this->oid; } public function oid(): string { return $this->oid; } protected function choiceASN1(): TaggedType { return ImplicitlyTaggedType::create($this->tag, ObjectIdentifier::create($this->oid)); } } 