@Test
public void testShouldTryAllKeysToVerifySignatureECV2() throws Exception {

  JSONObject trustedKeysJson = new JSONObject(GOOGLE_VERIFYING_PUBLIC_KEYS_JSON);
  JSONArray keys = trustedKeysJson.getJSONArray("keys");
  JSONObject correctKey =
      new JSONObject(keys.getJSONObject(INDEX_OF_GOOGLE_SIGNING_EC_V2).toString());
  JSONObject wrongKey =
      new JSONObject(keys.getJSONObject(INDEX_OF_GOOGLE_SIGNING_EC_V2).toString())
          .put("keyValue", ALTERNATE_PUBLIC_SIGNING_KEY);
  trustedKeysJson.put("keys", new JSONArray().put(wrongKey).put(correctKey));
  PaymentMethodTokenRecipient recipient =
      new PaymentMethodTokenRecipient.Builder()
          .protocolVersion(PaymentMethodTokenConstants.PROTOCOL_VERSION_EC_V2)
          .senderVerifyingKeys(trustedKeysJson.toString())
          .recipientId(RECIPIENT_ID)
          .addRecipientPrivateKey(MERCHANT_PRIVATE_KEY_PKCS8_BASE64)
          .build();
  assertEquals(PLAINTEXT, recipient.unseal(sealECV2(PLAINTEXT)));
}