Interface CryptoFunction

  • All Known Implementing Classes:
    Ed25519CryptoFunction

    public interface CryptoFunction
    A crypto function that provides several signature system crypto methods. All method arguments can't be null otherwise NullPointerException will be thrown.
    • Method Summary

      Modifier and Type Method Description
      KeyPair generateKeyPair()
      Generates a private key and a corresponding public key using a random seed.
      KeyPair generateKeyPair​(byte[] seed)
      Generates a private key and a corresponding public key using a seed byte array.
      byte[] signMessage​(byte[] message, PrivateKey privateKey)
      Given a privateKey, computes and returns a signature for the supplied message.
      boolean verify​(byte[] message, byte[] signature, PublicKey publicKey)
      Given a publicKey, verifies that signature is a valid signature for the supplied message.
    • Method Detail

      • generateKeyPair

        KeyPair generateKeyPair​(byte[] seed)
        Generates a private key and a corresponding public key using a seed byte array.
        Throws:
        IllegalArgumentException - if the specified seed is not valid
      • generateKeyPair

        KeyPair generateKeyPair()
        Generates a private key and a corresponding public key using a random seed.
      • signMessage

        byte[] signMessage​(byte[] message,
                           PrivateKey privateKey)
        Given a privateKey, computes and returns a signature for the supplied message.
        Returns:
        signature as a byte array
        Throws:
        IllegalArgumentException - if the private key is not valid for this cryptographic function
      • verify

        boolean verify​(byte[] message,
                       byte[] signature,
                       PublicKey publicKey)
        Given a publicKey, verifies that signature is a valid signature for the supplied message.
        Returns:
        true if signature is valid, false otherwise