public static final void validateEcdsa(
      ECPrivateKey privateKey,
      ECPublicKey publicKey,
      Enums.HashType hash,
      EllipticCurves.EcdsaEncoding encoding)
      throws GeneralSecurityException {

    EcdsaSignJce ecdsaSigner = new EcdsaSignJce(privateKey, hash, encoding);
    EcdsaVerifyJce ecdsaverifier = new EcdsaVerifyJce(publicKey, hash, encoding);
    try {
      ecdsaverifier.verify(
          ecdsaSigner.sign(TEST_MESSAGE.toByteArray()), TEST_MESSAGE.toByteArray());
    } catch (GeneralSecurityException e) {
      throw new GeneralSecurityException(
          "ECDSA signing with private key followed by verifying with public key failed."
              + " The key may be corrupted.",
          e);
    }
  }
Self Key tests validation helper methods.
java_src/src/main/java/com/google/crypto/tink/subtle/SelfKeyTestValidators.java