Interface KeyExchange.Lazy

All Known Implementing Classes:
LazySodium, LazySodiumJava
Enclosing interface:
KeyExchange

public static interface KeyExchange.Lazy
  • Method Details

    • 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 size KeyExchange.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 size KeyExchange.PUBLICKEYBYTES.
      clientSk - Client secret key of size KeyExchange.SECRETKEYBYTES.
      serverPk - Server public key of size KeyExchange.PUBLICKEYBYTES.
      Returns:
      A session pair of keys.
      Throws:
      SodiumException - If the size of any of the keys are wrong.
      See Also:
    • 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 size KeyExchange.PUBLICKEYBYTES.
      serverSk - Server secret key of size KeyExchange.SECRETKEYBYTES.
      clientPk - Client public key of size KeyExchange.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.