Key Exchange
Bindings for the crypto_kx API. See the libsodium crypto_kx docs for more information.
Constants
Buffer lengths (integer)
crypto_kx_PUBLICKEYBYTEScrypto_kx_SECRETKEYBYTEScrypto_kx_SEEDBYTEScrypto_kx_SESSIONKEYBYTES
String constants (string)
crypto_kx_PRIMITIVE
crypto_kx_keypair
sodium.crypto_kx_keypair(pk, sk)
Creates a key exchange key pair.
pkshould be abufferof lengthcrypto_kx_PUBLICKEYBYTESskshould be abufferof lengthcrypto_kx_SECRETKEYBYTES
crypto_kx_seed_keypair
sodium.crypto_kx_seed_keypair(pk, sk, seed)
Creates a key exchange key pair based on a seed.
pkshould be abufferof lengthcrypto_kx_PUBLICKEYBYTESskshould be abufferof lengthcrypto_kx_SECRETKEYBYTESseedshould be abufferof lengthcrypto_kx_SEEDBYTES
crypto_kx_client_session_keys
sodium.crypto_kx_client_session_keys(rx, tx, clientPk, clientSk, serverPk)
Generates a session receive and transmission key for a client. The public / secret keys should be generated using the key pair method above.
rxshould be abufferof lengthcrypto_kx_SESSIONKEYBYTESornulltxshould be abufferof lengthcrypto_kx_SESSIONKEYBYTESornull
You should use the rx to decrypt incoming data and tx to encrypt outgoing. If you need to make a one-way or half-duplex channel you can give only one of rx or tx.
crypto_kx_server_session_keys
sodium.crypto_kx_server_session_keys(rx, tx, serverPk, serverSk, clientPk)
Generates a session receive and transmission key for a server. The public / secret keys should be generated using the key pair method above.
rxshould be abufferof lengthcrypto_kx_SESSIONKEYBYTESornulltxshould be abufferof lengthcrypto_kx_SESSIONKEYBYTESornull
You should use the rx to decrypt incoming data and tx to encrypt outgoing. If you need to make a one-way or half-duplex channel you can give only one of rx or tx.
