Package com.goterl.lazysodium.interfaces
Interface KeyExchange.Lazy
-
- All Known Implementing Classes:
LazySodium,LazySodiumJava
- Enclosing interface:
- KeyExchange
public static interface KeyExchange.Lazy
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description SessionPaircryptoKxClientSessionKeys(KeyPair clientKeyPair, KeyPair serverKeyPair)Generate a client's session keys.SessionPaircryptoKxClientSessionKeys(Key clientPk, Key clientSk, Key serverPk)Generate a client's session keys.KeyPaircryptoKxKeypair()Generate a public and secret key.KeyPaircryptoKxKeypair(byte[] seed)Deterministically generate a public and secret key.SessionPaircryptoKxServerSessionKeys(KeyPair serverKeyPair, KeyPair clientKeyPair)Generate a server's session keys.SessionPaircryptoKxServerSessionKeys(Key serverPk, Key serverSk, Key clientPk)Computes a pair of shared keys (server-side) (rx and tx) using the client's public key clientPk, the server's secret key serverSk and the server's public key serverPk.
-
-
-
Method Detail
-
cryptoKxKeypair
KeyPair cryptoKxKeypair()
Generate a public and secret key.- Returns:
- A KeyPair containing a public and secret key.
-
cryptoKxKeypair
KeyPair cryptoKxKeypair(byte[] seed)
Deterministically generate a public and secret key. Store the seed somewhere if you want to generate these keys again.- Parameters:
seed- A random seed of sizeKeyExchange.SEEDBYTES.- Returns:
- The generated key pair.
-
cryptoKxClientSessionKeys
SessionPair cryptoKxClientSessionKeys(Key clientPk, Key clientSk, Key serverPk) throws SodiumException
Generate a client's session keys. This should be performed on the client.- Parameters:
clientPk- Client public key of sizeKeyExchange.PUBLICKEYBYTES.clientSk- Client secret key of sizeKeyExchange.SECRETKEYBYTES.serverPk- Server public key of sizeKeyExchange.PUBLICKEYBYTES.- Returns:
- A session pair of keys.
- Throws:
SodiumException- If the size of any of the keys are wrong.- See Also:
KeyExchange.Native.cryptoKxClientSessionKeys(byte[], byte[], byte[], byte[], byte[])
-
cryptoKxClientSessionKeys
SessionPair cryptoKxClientSessionKeys(KeyPair clientKeyPair, KeyPair serverKeyPair) throws SodiumException
Generate a client's session keys. This should be performed on the client.- Parameters:
clientKeyPair- Provide the client's public and private key.serverKeyPair- Provide the server's public key only.- Returns:
- Session keys.
- Throws:
SodiumException- Not provided the correct keys, or generation of session keys failed.
-
cryptoKxServerSessionKeys
SessionPair cryptoKxServerSessionKeys(Key serverPk, Key serverSk, Key clientPk) throws SodiumException
Computes a pair of shared keys (server-side) (rx and tx) using the client's public key clientPk, the server's secret key serverSk and the server's public key serverPk.- Parameters:
serverPk- Server public key of sizeKeyExchange.PUBLICKEYBYTES.serverSk- Server secret key of sizeKeyExchange.SECRETKEYBYTES.clientPk- Client public key of sizeKeyExchange.PUBLICKEYBYTES.- Returns:
- True if successful or false if the client public key is wrong.
- Throws:
SodiumException
-
cryptoKxServerSessionKeys
SessionPair cryptoKxServerSessionKeys(KeyPair serverKeyPair, KeyPair clientKeyPair) throws SodiumException
Generate a server's session keys. This should be performed on the server.- Parameters:
serverKeyPair- Provide the server's public and private key.clientKeyPair- Provide the client's public key only.- Returns:
- Session keys.
- Throws:
SodiumException- Not provided the correct keys, or generation of session keys failed.
-
-