Copyright | (C) Hécate Moonlight 2022 |
---|---|
License | BSD-3-Clause |
Maintainer | The Haskell Cryptography Group |
Stability | Stable |
Portability | GHC only |
Safe Haskell | None |
Language | Haskell2010 |
Synopsis
- cryptoKXKeyPair :: Ptr CUChar -> Ptr CUChar -> IO CInt
- cryptoKXSeedKeypair :: Ptr CUChar -> Ptr CUChar -> Ptr CUChar -> IO CInt
- cryptoKXClientSessionKeys :: Ptr CUChar -> Ptr CUChar -> Ptr CUChar -> Ptr CUChar -> Ptr CUChar -> IO CInt
- cryptoKXServerSessionKeys :: Ptr CUChar -> Ptr CUChar -> Ptr CUChar -> Ptr CUChar -> Ptr CUChar -> IO CInt
- cryptoKXPublicKeyBytes :: CSize
- cryptoKXSecretKeyBytes :: CSize
- cryptoKXSeedBytes :: CSize
- cryptoKXSessionKeyBytes :: CSize
- cryptoKXPrimitive :: Ptr CChar
Introduction
The key exchange API allows two parties to securely compute a set of shared keys using their peer's public key, and their own secret key.
Key Exchange
Key generation
:: Ptr CUChar | The buffer that will hold the public key, of size |
-> Ptr CUChar | The buffer that will hold the secret key, of size |
-> IO CInt | Returns 0 on success, -1 on error. |
Create a new key pair.
This function takes pointers to two empty buffers that will hold (respectively) the public and secret keys.
See: crypto_kx_keypair()
Since: 0.0.1.0
:: Ptr CUChar | The buffer that will hold the public key, of size |
-> Ptr CUChar | The buffer that will hold the secret key, of size |
-> Ptr CUChar | The pointer to the seed from which the keys are derived. It is of size |
-> IO CInt | Returns 0 on success, -1 on error. |
Create a new key pair from a seed.
This function takes pointers to two empty buffers that will hold (respectively) the public and secret keys, as well as the seed from which these keys will be derived.
Since: 0.0.1.0
Client
cryptoKXClientSessionKeys Source #
:: Ptr CUChar | A pointer to the buffer that will hold the shared secret key, of size |
-> Ptr CUChar | A pointer to the buffer that will hold the shared public key, of size |
-> Ptr CUChar | A pointer to the client's public key, of size |
-> Ptr CUChar | A pointer to the client's secret key, of size |
-> Ptr CUChar | A pointer to the server's public key, of size |
-> IO CInt | Returns 0 on success, -1 on error, such as when the server's public key is not acceptable. |
Compute a pair of shared session keys (secret and public).
These session keys are computed using:
- The client's public key
- The client's secret key
- The server's public key
The shared secret key should be used by the client to receive data from the server, whereas the shared public key should be used for data flowing to the server.
If only one session key is required, either the pointer to the shared secret key or the pointer
to the shared public key can be set to nullPtr
.
See: crypto_kx_client_session_keys()
Since: 0.0.1.0
Server
cryptoKXServerSessionKeys Source #
:: Ptr CUChar | A pointer to the buffer that will hold the shared secret key, of size |
-> Ptr CUChar | A pointer to the buffer that will hold the shared public key, of size |
-> Ptr CUChar | A pointer to the server's public key, of size |
-> Ptr CUChar | A pointer to the server's secret key, of size |
-> Ptr CUChar | A pointer to the client's public key, of size |
-> IO CInt | Returns 0 on success, -1 on error, such as when the server's public key is not acceptable. |
Compute a pair of shared session keys (secret and public).
These session keys are computed using:
- The server's public key
- The server's secret key
- The client's public key
The shared secret key should be used by the server to receive data from the client, whereas the shared public key should be used for data flowing to the client.
If only one session key is required, either the pointer to the shared secret key or the pointer
to the shared public key can be set to nullPtr
.
See: crypto_kx_server_session_keys()
Since: 0.0.1.0