Interface Sign.Lazy

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

public static interface Sign.Lazy
  • Method Details

    • cryptoSignKeypair

      KeyPair cryptoSignKeypair() throws SodiumException
      Generate a signing keypair (ed25519).
      Returns:
      Public and private keypair.
      Throws:
      SodiumException
    • cryptoSignSeedKeypair

      KeyPair cryptoSignSeedKeypair(byte[] seed) throws SodiumException
      Generate a signing keypair deterministically.
      Parameters:
      seed - The seed to generate keys.
      Returns:
      Public and private keypair.
      Throws:
      SodiumException
    • cryptoSignSecretKeyPair

      KeyPair cryptoSignSecretKeyPair(Key secretKey) throws SodiumException
      Generate a signing keypair (ed25519), given a secret ed25519 key.
      Parameters:
      secretKey - The ed25519 secret key.
      Returns:
      The private and public ed25519 keys.
      Throws:
      SodiumException
    • cryptoSign

      String cryptoSign(String message, String secretKey) throws SodiumException
      Sign a message.
      Parameters:
      message - The message to sign.
      secretKey - The secret key.
      Returns:
      A Helpers.Lazy.sodiumBin2Hex(byte[])-ified signed message.
      Throws:
      SodiumException
    • cryptoSign

      String cryptoSign(String message, Key secretKey) throws SodiumException
      Sign a message.
      Parameters:
      message - The message to sign.
      secretKey - The secret key.
      Returns:
      A Helpers.Lazy.sodiumBin2Hex(byte[])-ified signed message.
      Throws:
      SodiumException
    • cryptoSignOpen

      String cryptoSignOpen(String signedMessage, Key publicKey)
      Checks that a message is validly signed by a public key.
      Parameters:
      signedMessage - The signed message.
      publicKey - The public key that signed the message.
      Returns:
      Returns the message without a signature. If null, then the message is not validly signed by the publicKey.
    • cryptoSignDetached

      String cryptoSignDetached(String message, Key secretKey) throws SodiumException
      Returns a signature for a message. This does not prepend the signature to the message. See cryptoSign(String, String) for that.
      Parameters:
      message - The message to sign.
      secretKey - The secret key.
      Returns:
      The signature for a message.
      Throws:
      SodiumException - If could not sign.
    • cryptoSignVerifyDetached

      boolean cryptoSignVerifyDetached(String signature, String message, Key publicKey)
      Verifies that signature is valid for the message.
      Parameters:
      signature - The signature.
      message - The message.
      publicKey - The public key that signed the message.
      Returns:
      Returns true if the signature is valid for the message.
      See Also:
    • convertKeyPairEd25519ToCurve25519

      KeyPair convertKeyPairEd25519ToCurve25519(KeyPair ed25519KeyPair) throws SodiumException
      Converts a ed25519 keypair to a curve25519 keypair.
      Parameters:
      ed25519KeyPair - The key pair.
      Returns:
      curve25519KeyPair
      Throws:
      SodiumException - If conversion was unsuccessful.