@Test
public void validateKey_badParams_throws() throws Exception {

  EcdsaPublicKey validKey = validPublicKey();
  EcdsaPublicKey wrongHashKey =
      EcdsaPublicKey.newBuilder(validKey)
          .setParams(
              EcdsaParams.newBuilder(validKey.getParams())
                  .setHashType(HashType.SHA256)
                  .setCurve(EllipticCurveType.NIST_P521)
                  .build())
          .build();
  try {
    verifyManager.validateKey(wrongHashKey);
    fail();
  } catch (GeneralSecurityException e) {
    // expected.
  }
}