ltcastelnuovo
07/14/2020, 1:19 PMhttps://server.com/auth/key
> 2. Server: Generate keypair (maybe 2048bits if performance allows it)
> 3. Server: Encrypt privateKey
with applicationKey
(set in .env)
> 4. Server: Store encryptedPrivateKey
in DB with an random keyId
> 5. Server: Return publicKey
and keyId
to Client
> 6. Client: The middleware will then encrypt the original payload with this publicKey
and also provide the keyId
> 7. Client: Sends request
> 8. Server: Looks up keyId
in DB and gets encryptedPrivateKey
> 9. Server: Decrypts encryptedPrivateKey
and gets privateKey
> 10. Server: Decrypts request
> 11. Server: Handles request