V
V
vozvratiKota2020-09-06 15:52:01
Node.js
vozvratiKota, 2020-09-06 15:52:01

Node.js, client side public key encryption. How it's done?

Hello! I'm trying to write authorization (for now, just registration) in Node.js, but I don't understand how to do it right.
According to my ideas:
The client accesses the server, the server generates two keys - public and private, the public is sent to the client along with the authorization page. The client comes up with and enters a username and password, after which they are hashed, the hash is encrypted with a public key and sent back. The server decrypts with a private key, adds the resulting hash to the database.
And here comes the question:
On the server side, Node.js has a lot of built-in modules for key generation, encryption-decryption, hash functions, but how does client-side encryption work? It turns out that the server should send the function of encryption and hashing? Is it even possible to do this in JavaScript, because it uses exponentiation and very large numbers?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question