Example usage for org.bouncycastle.math.ec.rfc8032 Ed448 verify

List of usage examples for org.bouncycastle.math.ec.rfc8032 Ed448 verify

Introduction

In this page you can find the example usage for org.bouncycastle.math.ec.rfc8032 Ed448 verify.

Prototype

public static boolean verify(byte[] sig, int sigOff, byte[] pk, int pkOff, byte[] ctx, byte[] m, int mOff,
            int mLen) 

Source Link

Usage

From source file:net.java.otr4j.crypto.ed448.EdDSAKeyPair.java

License:LGPL

/**
 * Verify a signature for a message, given the public key.
 *
 * @param publicKey The public key of the key pair that generated the signature.
 * @param message   The message that was signed.
 * @param signature The signature.//from w w w  .j av  a2 s .co m
 * @throws ValidationException In case we fail to validate the message against the provided signature.
 */
public static void verify(final Point publicKey, final byte[] message, final byte[] signature)
        throws ValidationException {
    assert !allZeroBytes(signature) : "Expected random data for signature instead of all zero-bytes.";
    if (!Ed448.verify(signature, 0, publicKey.getEncoded(), 0, ED448_CONTEXT, message, 0, message.length)) {
        throw new ValidationException("Signature is not valid for provided message.");
    }
}