Interface SignatureValidator

Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface SignatureValidator
General purpose functional interface to verify signatures.
Built in validators:
  • Field Details

  • Method Details

    • validate

      boolean validate(byte[] payload, byte[] signature)
      Validate signature. This should not throw any exception instead it should return false.
      Returns:
      true only if the signature is valid
    • validate

      default boolean validate(Consumer<NetworkBuffer> payload, byte[] signature)
    • from

      static SignatureValidator from(PublicKey publicKey, KeyUtils.SignatureAlgorithm algorithm)
    • from

      @Nullable static @Nullable SignatureValidator from(Player player)
      Creates a validator from the player's public key using SHA256 with RSA
      Parameters:
      player - source of the key
      Returns:
      null if the player didn't send a public key