How does JWE guarantee authentication?

66 Views Asked by At

I know about JWT/JWS where you sign a a token using a private key. You can spread the public publicly on the internet and everyone can verify the token was made by you.

However, with JWE the public key is used to encrypt the token, and the private key is used to decrypt the token. If I publicly spread the public key, everyone can create a token and I am the only one able to decrypt it. SO how is the token authenticated if everyone can make it?

1

There are 1 best solutions below

0
Spomky-Labs On

The benefits of the cypher operations are of different purpose. The main benefits are as follows:

  • The digital signature offers authentication, integrity and non-repudiation
  • The data encryption offers confidentiality and integrity.

Only the JWS offers you authentication (you know who the issuer is). When you receive a JWE, you cannot know who computed it. However, you can have all benefits at once when using nested tokens i.e. the JWE payload is a JWS.