CoreFiles by mySites.guru
UniqueIdentifier.php65 lines, 1,198 bytes, from Joomla_5.0.0-alpha1-Alpha-Full_Package.zip
Raw History Compare with 4.4.0-alpha4
md5
31183f553197a63230f317acc3515e46
sha1
9f5ea69b8c13513bad9cc8584a4172a088ed864d
sha256
0ec35ab065b6b81c3494e309355a52d6ca10701c10e2e1dcd7aa957c9c248b88
<?php

declare(strict_types=1);

namespace SpomkyLabs\Pki\X509\Certificate;

use SpomkyLabs\Pki\ASN1\Type\Primitive\BitString;

/**
 * Implements *UniqueIdentifier* ASN.1 type.
 *
 * @see https://tools.ietf.org/html/rfc5280#section-4.1.2.8
 */
final class UniqueIdentifier
{
    private function __construct(
        private readonly BitString $uid
    ) {
    }

    public static function create(BitString $uid): self
    {
        return new self($uid);
    }

    /**
     * Initialize from ASN.1.
     */
    public static function fromASN1(BitString $bs): self
    {
        return self::create($bs);
    }

    /**
     * Initialize from string.
     */
    public static function fromString(string $str): self
    {
        return self::create(BitString::create($str));
    }

    /**
     * Get unique identifier as a string.
     */
    public function string(): string
    {
        return $this->uid->string();
    }

    /**
     * Get unique identifier as a bit string.
     */
    public function bitString(): BitString
    {
        return $this->uid;
    }

    /**
     * Get ASN.1 element.
     */
    public function toASN1(): BitString
    {
        return $this->uid;
    }
}

The same content is in 158 releases, Joomla 5.0.0-alpha1 to 6.3.0-alpha1. See them all, or every version of this file.