ParagonIE_Sodium_Compat::crypto_sign() public WP 1.0
Returns a signed message. You probably want crypto_sign_detached() instead, which only returns the signature.
Algorithm: Ed25519 (EdDSA over Curve25519)
{} It's a method of the class: ParagonIE_Sodium_Compat{}
No Hooks.
Return
String
. Signed message (signature is prefixed).
Usage
$result = ParagonIE_Sodium_Compat::crypto_sign( $message, $secretKey );
- $message(string) (required)
- Message to be signed.
- $secretKey(string) (required)
- Secret signing key.
Code of ParagonIE_Sodium_Compat::crypto_sign() ParagonIE Sodium Compat::crypto sign WP 5.7.1
public static function crypto_sign($message, $secretKey)
{
/* Type checks: */
ParagonIE_Sodium_Core_Util::declareScalarType($message, 'string', 1);
ParagonIE_Sodium_Core_Util::declareScalarType($secretKey, 'string', 2);
/* Input validation: */
if (ParagonIE_Sodium_Core_Util::strlen($secretKey) !== self::CRYPTO_SIGN_SECRETKEYBYTES) {
throw new SodiumException('Argument 2 must be CRYPTO_SIGN_SECRETKEYBYTES long.');
}
if (self::useNewSodiumAPI()) {
return sodium_crypto_sign($message, $secretKey);
}
if (self::use_fallback('crypto_sign')) {
return (string) call_user_func('\\Sodium\\crypto_sign', $message, $secretKey);
}
if (PHP_INT_SIZE === 4) {
return ParagonIE_Sodium_Crypto32::sign($message, $secretKey);
}
return ParagonIE_Sodium_Crypto::sign($message, $secretKey);
}