ParagonIE_Sodium_Compat::crypto_sign_publickey_from_secretkey

Advertisement

Summery Summery

Calculate an Ed25519 public key from an Ed25519 secret key.

Syntax Syntax

ParagonIE_Sodium_Compat::crypto_sign_publickey_from_secretkey( string $secretKey )

Parameters Parameters

$secretKey

(Required) Your Ed25519 secret key

Return Return

(string) The corresponding Ed25519 public key

Source Source

File: wp-includes/sodium_compat/src/Compat.php

    public static function crypto_sign_publickey_from_secretkey($secretKey)
    {
        /* Type checks: */
        ParagonIE_Sodium_Core_Util::declareScalarType($secretKey, 'string', 1);

        /* Input validation: */
        if (ParagonIE_Sodium_Core_Util::strlen($secretKey) !== self::CRYPTO_SIGN_SECRETKEYBYTES) {
            throw new SodiumException('Argument 1 must be CRYPTO_SIGN_SECRETKEYBYTES long.');
        }

        if (self::useNewSodiumAPI()) {
            return sodium_crypto_sign_publickey_from_secretkey($secretKey);
        }
        if (self::use_fallback('crypto_sign_publickey_from_secretkey')) {
            return (string) call_user_func('\\Sodium\\crypto_sign_publickey_from_secretkey', $secretKey);
        }
        if (PHP_INT_SIZE === 4) {
            return ParagonIE_Sodium_Core32_Ed25519::publickey_from_secretkey($secretKey);
        }
        return ParagonIE_Sodium_Core_Ed25519::publickey_from_secretkey($secretKey);
    }

Advertisement

Advertisement

Leave a Reply