Class Ed25519Verifier

java.lang.Object
io.jans.lock.trace.crypto.bc.Ed25519Verifier

@ApplicationScoped public class Ed25519Verifier extends Object
Verifies Ed25519 (RFC 8032, PureEdDSA, no pre-hash, no context) signatures with the JCA Signature of the installed BouncyCastle provider. Constant-time behaviour is the provider's responsibility; this class never compares signature bytes itself beyond the length check.

Stateless and thread-safe: a fresh Signature instance is created per call.

Author:
Yuriy Movchan
  • Field Details

    • SIGNATURE_LENGTH

      public static final int SIGNATURE_LENGTH
      Length of an Ed25519 signature (RFC 8032 §5.1.6).
      See Also:
  • Constructor Details

    • Ed25519Verifier

      public Ed25519Verifier()
  • Method Details

    • verify

      public boolean verify(PublicKey key, byte[] message, byte[] signature)
      Parameters:
      key - the producer's public key, from Ed25519PublicKeys
      message - the exact bytes that were signed (for TRACE: UTF-8 of the JCS form of the assertion without signature)
      signature - the raw 64-byte signature
      Returns:
      true only if the provider accepts the signature; false for a null or wrongly sized signature and for every signature the provider rejects
      Throws:
      IllegalArgumentException - if key or message is null
      TraceCryptoException - with reason crypto_unavailable if the provider has no Ed25519 Signature, or invalid_key if it rejects the key