ParagonIE_Sodium_Compat::crypto_sign_publickey

Advertisement

Summery Summery

Extract an Ed25519 public key from an Ed25519 keypair.

Syntax Syntax

ParagonIE_Sodium_Compat::crypto_sign_publickey( string $keypair )

Parameters Parameters

$keypair

(Required) Keypair

Return Return

(string) Public key

Source Source

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

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

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

        if (self::useNewSodiumAPI()) {
            return sodium_crypto_sign_publickey($keypair);
        }
        if (self::use_fallback('crypto_sign_publickey')) {
            return (string) call_user_func('\\Sodium\\crypto_sign_publickey', $keypair);
        }
        if (PHP_INT_SIZE === 4) {
            return ParagonIE_Sodium_Core32_Ed25519::publickey($keypair);
        }
        return ParagonIE_Sodium_Core_Ed25519::publickey($keypair);
    }

Advertisement

Advertisement

Leave a Reply