%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /dom495844/wp-content/plugins/wordpress-seo/src/myyoast-client/infrastructure/crypto/
Upload File :
Create Path :
Current File : /dom495844/wp-content/plugins/wordpress-seo/src/myyoast-client/infrastructure/crypto/key-pair.php

<?php
// phpcs:disable Yoast.NamingConventions.NamespaceName.TooLong -- Needed in the folder structure.

namespace Yoast\WP\SEO\MyYoast_Client\Infrastructure\Crypto;

use InvalidArgumentException;
use SensitiveParameter;

/**
 * Immutable value object representing an Ed25519 key pair with its key ID.
 */
class Key_Pair {

	/**
	 * The 32-byte Ed25519 public key.
	 *
	 * @var string
	 */
	private $public_key;

	/**
	 * The 64-byte Ed25519 secret key (keypair format).
	 *
	 * @var string
	 */
	private $private_key;

	/**
	 * The key ID (derived from the public key thumbprint).
	 *
	 * @var string
	 */
	private $kid;

	/**
	 * Key_Pair constructor.
	 *
	 * @param string $public_key  The 32-byte Ed25519 public key.
	 * @param string $private_key The 64-byte Ed25519 secret key.
	 * @param string $kid         The key ID.
	 *
	 * @throws InvalidArgumentException If key lengths are invalid.
	 */
	public function __construct(
		string $public_key,
		// phpcs:ignore PHPCompatibility.Attributes.NewAttributes.PHPNativeAttributeFound -- No-op on PHP < 8.2; redacts parameter from stack traces on PHP 8.2+.
		#[SensitiveParameter]
		string $private_key,
		string $kid
	) {
		if ( \strlen( $public_key ) !== \SODIUM_CRYPTO_SIGN_PUBLICKEYBYTES ) {
			throw new InvalidArgumentException(
				// phpcs:ignore WordPress.Security.EscapeOutput.ExceptionNotEscaped -- Internal exception message.
				\sprintf( 'Public key must be %d bytes, got %d.', \SODIUM_CRYPTO_SIGN_PUBLICKEYBYTES, \strlen( $public_key ) ),
			);
		}
		if ( \strlen( $private_key ) !== \SODIUM_CRYPTO_SIGN_SECRETKEYBYTES ) {
			throw new InvalidArgumentException(
				// phpcs:ignore WordPress.Security.EscapeOutput.ExceptionNotEscaped -- Internal exception message.
				\sprintf( 'Private key must be %d bytes, got %d.', \SODIUM_CRYPTO_SIGN_SECRETKEYBYTES, \strlen( $private_key ) ),
			);
		}

		$this->public_key  = $public_key;
		$this->private_key = $private_key;
		$this->kid         = $kid;
	}

	/**
	 * Returns the public key.
	 *
	 * @return string The 32-byte Ed25519 public key.
	 */
	public function get_public_key(): string {
		return $this->public_key;
	}

	/**
	 * Returns the private key.
	 *
	 * @return string The 64-byte Ed25519 secret key.
	 */
	public function get_private_key(): string {
		return $this->private_key;
	}

	/**
	 * Returns the key ID.
	 *
	 * @return string The key ID.
	 */
	public function get_kid(): string {
		return $this->kid;
	}
}

Zerion Mini Shell 1.0
Page not found - Broad Street Financial
[et_pb_section fb_built=”1″ theme_builder_area=”post_content” _builder_version=”4.20.0″ _module_preset=”default”][et_pb_row _builder_version=”4.20.0″ _module_preset=”default” theme_builder_area=”post_content”][et_pb_column _builder_version=”4.20.0″ _module_preset=”default” type=”4_4″ theme_builder_area=”post_content”][et_pb_text _builder_version=”4.20.0″ _module_preset=”default” theme_builder_area=”post_content” hover_enabled=”0″ sticky_enabled=”0″]

Page Not Found

Sorry the requested page you are looking for is missing or has been moved.

Please check out our site and see if you can find what you are looking for.

[/et_pb_text][/et_pb_column][/et_pb_row][/et_pb_section]