public void testWithA256GCM()
throws Exception {
JWEHeader header = new JWEHeader(JWEAlgorithm.RSA_OAEP, EncryptionMethod.A256GCM);
Payload payload = new Payload("I think therefore I am.");
JWEObject jweObject = new JWEObject(header, payload);
assertEquals("State check", JWEObject.State.UNENCRYPTED, jweObject.getState());
JWEEncrypter encrypter = new RSAEncrypter(publicKey);
assertEquals(publicKey, ((RSAEncrypter)encrypter).getPublicKey());
jweObject.encrypt(encrypter);
assertEquals("State check", JWEObject.State.ENCRYPTED, jweObject.getState());
String jweString = jweObject.serialize();
jweObject = JWEObject.parse(jweString);
assertEquals("State check", JWEObject.State.ENCRYPTED, jweObject.getState());
JWEDecrypter decrypter = new RSADecrypter(privateKey);
assertEquals(privateKey, ((RSADecrypter)decrypter).getPrivateKey());
jweObject.decrypt(decrypter);
assertEquals("State check", JWEObject.State.DECRYPTED, jweObject.getState());
payload = jweObject.getPayload();
assertEquals("I think therefore I am.", payload.toString());
}