Interface KeyExchange.Lazy

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

public static interface KeyExchange.Lazy
  • Method Details

    • cryptoKxKeypair

      KeyPair cryptoKxKeypair() throws SodiumException
      Generate a public and secret key.
      Returns:
      A KeyPair containing a public and secret key.
      Throws:
      SodiumException
    • cryptoKxKeypair

      KeyPair cryptoKxKeypair(byte[] seed) throws SodiumException
      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.
      Throws:
      SodiumException
    • 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

      @Deprecated(forRemoval=true, since="6.0.0") SessionPair cryptoKxClientSessionKeys(KeyPair clientKeyPair, KeyPair serverKeyPair) throws SodiumException
      Deprecated, for removal: This API element is subject to removal in a future version.
      Client should not have the whole server keypair including the secret key!
      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.
    • cryptoKxClientSessionKeys

      SessionPair cryptoKxClientSessionKeys(KeyPair clientKeyPair, Key serverPublicKey) 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.
      serverPublicKey - Provide the server's public key.
      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

      @Deprecated(forRemoval=true, since="6.0.0") SessionPair cryptoKxServerSessionKeys(KeyPair serverKeyPair, KeyPair clientKeyPair) throws SodiumException
      Deprecated, for removal: This API element is subject to removal in a future version.
      Client should not have the whole server keypair including the secret key!
      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.
    • cryptoKxServerSessionKeys

      SessionPair cryptoKxServerSessionKeys(KeyPair serverKeyPair, Key clientPublicKey) 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.
      clientPublicKey - Provide the client's public key.
      Returns:
      Session keys.
      Throws:
      SodiumException - Not provided the correct keys, or generation of session keys failed.