ParagonIE_Sodium_Compat::crypto_box_secretkey() public WP 1.0
Extract the secret key from a crypto_box keypair.
{} It's a method of the class: ParagonIE_Sodium_Compat{}
No Hooks.
Return
String
. Your crypto_box secret key
Usage
$result = ParagonIE_Sodium_Compat::crypto_box_secretkey( $keypair );
- $keypair(string) (required)
- -
Code of ParagonIE_Sodium_Compat::crypto_box_secretkey() ParagonIE Sodium Compat::crypto box secretkey WP 5.7
public static function crypto_box_secretkey($keypair)
{
/* Type checks: */
ParagonIE_Sodium_Core_Util::declareScalarType($keypair, 'string', 1);
/* Input validation: */
if (ParagonIE_Sodium_Core_Util::strlen($keypair) !== self::CRYPTO_BOX_KEYPAIRBYTES) {
throw new SodiumException('Argument 1 must be CRYPTO_BOX_KEYPAIRBYTES long.');
}
if (self::useNewSodiumAPI()) {
return (string) sodium_crypto_box_secretkey($keypair);
}
if (self::use_fallback('crypto_box_secretkey')) {
return (string) call_user_func('\\Sodium\\crypto_box_secretkey', $keypair);
}
if (PHP_INT_SIZE === 4) {
return ParagonIE_Sodium_Crypto32::box_secretkey($keypair);
}
return ParagonIE_Sodium_Crypto::box_secretkey($keypair);
}