1

So I read that JSON Web Encryption (JWE) uses only authenticated encryption. By that I understand, that the integrity of the payload is ensured by using something like AES-GCD.

However, I also see that JWE supports RSA-OAEP. How is integrity ensured when using RSA? Also, how can you encrypt a (typically large) JSON file with RSA? I thought RSA has a very low payload length limit.

1
  • Will try and get to a computer to type out fuller answer. But authenticated encryption isn't necessarily about integrity. I mean it is, but it's more to do with proof of origin of encryption. Encryption by default offers no authentication, meaning just because its encrypted doesn't mean you can prove by whom.
    – ISMSDEV
    Jun 23 '17 at 20:31
1

JWE specifies the use or RSA-OEAP for key encryption, not content encryption. So you would still use an AEAD algorithm such as AES-GCM to encrypt the JSON, and the use RSA-OEAP to encrypt the key so that it can be securely transmitted to the receiver along with the encrypted data.

This mechanism still preserves the integrity of the data. All an attacker, even an active man-in-the-middle can do would be to fiddle with the encrypted key, the ciphertext, or the tag. If any of these are tampered with, the authentication will fail, and the receiver will know that tampering occurred and that further decryption of the content is either not possible or not safe.

1
  • The following seems to be incorrect, based on my understanding of JWE: "So you would still use an AEAD algorithm such as AES-GCM to encrypt the JSON" An algorithm like AES-GCM is used to encrypt the plaintext, i.e. the actual message being sent, not the "JSON" (which could be misinterpreted to mean the complete JSON string representation of the JWE object). Of course, the plaintext could be JSON but it could as well be text/plain or something generic like application/octet-stream Nov 27 '17 at 19:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.