(PHP 7 >= 7.2.0, PHP 8)
sodium_crypto_kx_client_session_keys — Calculate the client-side session keys.
$client_key_pair, string $server_key): arrayCalculate the client-side session keys, using the X25519 + BLAKE2b key-exchange method.
client_key_pairA crypto_kx keypair, such as one generated by sodium_crypto_kx_keypair().
server_keyA crypto_kx public key.
An array consisting of two strings. The first should be used for receiving data from the server. The second should be used for sending data to the server.
Throws a SodiumException if
client_key_pair is not
SODIUM_CRYPTO_KX_KEYPAIRBYTES bytes long.
Throws a SodiumException if
server_key is not
SODIUM_CRYPTO_KX_PUBLICKEYBYTES bytes long.
Throws a SodiumException if the shared secret cannot be computed.