Using JWS for digital signature with content encryption

115 Views Asked by At

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

0

There are 0 best solutions below