0

I am creating a system that acts as a mediator between two entities. A sender initiates a request, my system creates a payload, then forwards it to a recipient which has the identity details of the sender (plus extra things).

I need to ensure of 2 things.

  • The payload is verified from my system (digital signing)
  • Only a particular recipient can accept and read it (encrypting).

To achieve this I am thinking of encrypting the content using the recipient's public key. Since I don't have their private key, I cannot just sign it. I can then use my private key to sign it so the recipient can verify the payload. Basically a JWS with encrypted content.

This means that the recipient can verify the digital signature and then be the only person to decrypt and use the content.

Should JWS be used like this? I know JWE exists but then I cannot digitally sign it. Is there another standard I should be using?

In the future, I would also like the sender to have a signature in the payload so the recipient can ultimately verify my system and the sender.

I've also been researching DIDs in which I can act as a controller. However, I am still understanding this so not too clear if this would solve my problem

Decrypter
  • 2,784
  • 12
  • 38
  • 57
  • What you are describing is nested tokens: https://www.rfc-editor.org/rfc/rfc7519#appendix-A.2 where the JWS is the payload of a JWE – Spomky-Labs Sep 04 '22 at 04:52
  • I see. Thanks for the link. I'm also experimenting with PASETO so I think I can do something similar. If I also want the sender to sign the nested payload. I should first create the payload and sign it myself. Then somehow send it back to the sender to sign with their private key. Finally, put into JWE? – Decrypter Sep 04 '22 at 20:32

0 Answers0