" \"crv\":\"P-256\",\n" +
" \"x\":\"weNJy2HscCSM6AEDTDg04biOvhFhyyWvOHQfeF_PxMQ\",\n" +
" \"y\":\"e8lnCO-AlStT-NJVX-crhB7QRYhiix03illJOVAOyck\",\n" +
" \"d\":\"VEmDZpDXXK8p8N0Cndsxs924q6nS1RXFASRl6BfUqdw\"\n" +
"}";
PublicJsonWebKey receiverJwk = PublicJsonWebKey.Factory.newPublicJwk(receiverJwkJson);
jwe.setAlgorithmHeaderValue(alg);
jwe.setEncryptionMethodHeaderParameter(enc);
String plaintext = "Gambling is illegal at Bushwood sir, and I never slice.";
jwe.setPlaintext(plaintext);
jwe.setKey(receiverJwk.getPublicKey());
String compactSerialization = jwe.getCompactSerialization();
log.debug("JWE w/ " + alg + " & " + enc +": " + compactSerialization);
JsonWebEncryption receiverJwe = new JsonWebEncryption();
receiverJwe.setCompactSerialization(compactSerialization);
receiverJwe.setKey(receiverJwk.getPrivateKey());
assertEquals(plaintext, receiverJwe.getPlaintextString());
}