@Test
public void testShouldFailIfSignedKeyWasChangedInECV2() throws Exception {

  PaymentMethodTokenRecipient recipient =
      new PaymentMethodTokenRecipient.Builder()
          .protocolVersion(PaymentMethodTokenConstants.PROTOCOL_VERSION_EC_V2)
          .senderVerifyingKeys(GOOGLE_VERIFYING_PUBLIC_KEYS_JSON)
          .recipientId(RECIPIENT_ID)
          .addRecipientPrivateKey(MERCHANT_PRIVATE_KEY_PKCS8_BASE64)
          .build();
  JSONObject payload = new JSONObject(sealECV2(PLAINTEXT));
  payload
      .getJSONObject("intermediateSigningKey")
      .put(
          "signedKey",
          payload.getJSONObject("intermediateSigningKey").getString("signedKey") + " ");
  try {
    recipient.unseal(payload.toString());
    fail("Expected GeneralSecurityException");
  } catch (GeneralSecurityException e) {
    assertEquals("cannot verify signature", e.getMessage());
  }
}