@Test
public void testWithKeysGeneratedByRecipientKeyGen() throws Exception {

  ECParameterSpec spec = EllipticCurves.getNistP256Params();
  KeyPairGenerator keyGen = KeyPairGenerator.getInstance("EC");
  keyGen.initialize(spec);
  String senderId = "foo";
  String recipientId = "bar";
  KeyPair senderKey = keyGen.generateKeyPair();
  ECPublicKey senderPublicKey = (ECPublicKey) senderKey.getPublic();
  ECPrivateKey senderPrivateKey = (ECPrivateKey) senderKey.getPrivate();
  // The keys here are generated by PaymentMethodTokenRecipientKeyGen.
  String recipientPrivateKey =
      "MEECAQAwEwYHKoZIzj0CAQYIKoZIzj0DAQcEJzAlAgEBBCAP5/1502pXYdMion22yiWK"
          + "GoTBJN/wAAfdjBU6puyEMw==";
  String recipientPublicKey =
      "BJ995jnw2Ppn4BMP/ZKtlTOOIBQC+/L3PDcFRjowZuCkRqUZ/kGWE8c+zimZNHOZPzLB"
          + "NVGJ3V8M/fM4g4o02Mc=";
  PaymentMethodTokenSender sender =
      new PaymentMethodTokenSender.Builder()
          .senderId(senderId)
          .senderSigningKey(senderPrivateKey)
          .recipientId(recipientId)
          .rawUncompressedRecipientPublicKey(recipientPublicKey)
          .build();
  PaymentMethodTokenRecipient recipient =
      new PaymentMethodTokenRecipient.Builder()
          .senderId(senderId)
          .addSenderVerifyingKey(senderPublicKey)
          .recipientId(recipientId)
          .addRecipientPrivateKey(recipientPrivateKey)
          .build();
  String plaintext = "blah";
  assertEquals(plaintext, recipient.unseal(sender.seal(plaintext)));
}