简体   繁体   中英

PKCE with RSA both ways

Can PKCE be implemented with both server and client generating public and private keys? Is it worth it? What I think is this flow:

  1. Client generates private and public key
  2. Client sends public key to server
  3. Server generates private and public key, generates random secret and encrypts secret with clients public key
  4. Server sends back to client encrypted secret and servers public key
  5. Client decrypts secret with his secret key, encrypts it again with servers public key and sends encrypted secret back to server
  6. Server decrypts secret with his private key and check if generated and now decrypted secret are the same

Am I missing something? Is this bad approach? Is this encryprtion/decryption/generating keys heavy to compute?

Your algorithm seems to be as secure as the PKCE standard. I don't think there's any additional value in encrypting the random strings. You also add one roundtrip to the server, as in PKCE it is the client who generates the initial random string.

Encrypting consumes resources and it's simple to implement it wrong. You also need support for encryption algorithms on both the server and the client side. Thus, I think it's just redundant to try to add that encryption to a proven standard.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM