|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2018-08-25 19:20 UTC] craig at craigfrancis dot co dot uk
Description: ------------ http://www.php.net/function.sodium-crypto-sign-detached.php Needs to be changed from "$keypair" to "$secret_key". http://www.php.net/function.sodium-crypto-sign-open http://www.php.net/function.sodium-crypto-sign-verify-detached Both should use "$public_key" - not "$keypair" or "$key". This would be consistent with the use of "$secret_key" in the signing function: http://www.php.net/function.sodium-crypto-sign.php PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Oct 24 02:00:01 2025 UTC |
In my opinion, it is most sensible to document the parameter names as they are given by reflection. E.g.: # php --rf sodium_crypto_sign_detached Function [ <internal:sodium> function sodium_crypto_sign_detached ] { - Parameters [2] { Parameter #0 [ <required> $string ] Parameter #1 [ <required> $keypair ] } } # php --rf sodium_crypto_sign Function [ <internal:sodium> function sodium_crypto_sign ] { - Parameters [2] { Parameter #0 [ <required> $string ] Parameter #1 [ <required> $keypair ] } }Fair point... in which case the underlying code needs to be fixed. Taking `sodium_crypto_sign_detached` as an example: <?php $key_pair = sodium_crypto_sign_keypair(); $secret_key = sodium_crypto_sign_secretkey($key_pair); $public_key = sodium_crypto_sign_publickey($key_pair); $signature = sodium_crypto_sign_detached('Hello', $secret_key); $signature = sodium_crypto_sign_detached('Hello', $key_pair); ?> The second line, which is provided a keypair (as per the documentation), returns the following error: SodiumException: secret key size should be SODIUM_CRYPTO_SIGN_SECRETKEYBYTES bytes And if you go to the LibSodium documentation, it references "sk" (aka the secret key): "The crypto_sign_detached() function signs the message m whose length is mlen bytes, using the secret key sk..." https://download.libsodium.org/doc/public-key_cryptography/public-key_signatures.html#detached-mode Do I assume that all the LibSodium functions will need to be checked/updated?