CoreFiles by mySites.guru
IssuerAlternativeNameExtension.php44 lines, 1,114 bytes, from Joomla_5.4.3-Stable-Full_Package.zip
Raw History Compare with 5.4.2
md5
205efd2af352dfe917a5787c10106c97
sha1
639cf2bbadd8feda82b11df018f84b2f28cd94f7
sha256
63c4801391be391ba49a1cb912a9abfaa92e78a4fa283ea7595a9d104914a190
<?php

declare(strict_types=1);

namespace SpomkyLabs\Pki\X509\Certificate\Extension;

use SpomkyLabs\Pki\ASN1\Element;
use SpomkyLabs\Pki\ASN1\Type\UnspecifiedType;
use SpomkyLabs\Pki\X509\GeneralName\GeneralNames;

/**
 * Implements 'Issuer Alternative Name' certificate extension.
 *
 * @see https://tools.ietf.org/html/rfc5280#section-4.2.1.7
 */
final class IssuerAlternativeNameExtension extends Extension
{
    private function __construct(
        bool $critical,
        private readonly GeneralNames $names
    ) {
        parent::__construct(self::OID_ISSUER_ALT_NAME, $critical);
    }

    public static function create(bool $critical, GeneralNames $names): self
    {
        return new self($critical, $names);
    }

    public function names(): GeneralNames
    {
        return $this->names;
    }

    protected static function fromDER(string $data, bool $critical): static
    {
        return self::create($critical, GeneralNames::fromASN1(UnspecifiedType::fromDER($data)->asSequence()));
    }

    protected function valueASN1(): Element
    {
        return $this->names->toASN1();
    }
}

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.