Package net.minestom.server.crypto
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.
General purpose functional interface to verify signatures.
Built in validators:
Built in validators:
PASS
: will always report trueFAIL
: will always report falseYGGDRASIL
: Uses SHA1 with RSA and Yggdrasil Public Key for verifying signaturesfrom(Player)
: Uses SHA256 with RSA and the Player'sPlayerPublicKey.publicKey()
from(PublicKey, KeyUtils.SignatureAlgorithm)
: General purpose factory method
-
Field Summary
Modifier and TypeFieldDescriptionstatic final SignatureValidator
static final SignatureValidator
static final SignatureValidator
-
Method Summary
Modifier and TypeMethodDescriptionstatic SignatureValidator
from
(PublicKey publicKey, KeyUtils.SignatureAlgorithm algorithm) static @Nullable SignatureValidator
Creates a validator from the player's public key using SHA256 with RSAboolean
validate
(byte[] payload, byte[] signature) Validate signature.default boolean
validate
(Consumer<NetworkBuffer> payload, byte[] signature)
-
Field Details
-
PASS
-
FAIL
-
YGGDRASIL
-
-
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
-
from
-
from
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
-