RAKTIM BANERJEE
RAKTIM BANERJEE

Reputation: 314

Diffie Hellman algorithm on browser

NodeJS have crypto module where DiffieHellman is a class. So, I can use this method to generate key and compute key.

But, client also need to create another instance of diffiehellman class. But how to do that? Can I use crypto module on client side? If yes then how, any solution? Here are my client side code...

const crypto = require('crypto');
const express = require('express');
const app = express();

// Generate server's keys...
const server = crypto.createDiffieHellman(139);
const serverKey = server.generateKeys();
//send p=prime and g=generator to the client

Upvotes: 0

Views: 958

Answers (1)

Pyroarsonist
Pyroarsonist

Reputation: 185

Node.js has own "crypto" module to use DiffieHellman algorithm, so you can watch it and write it on browser on your own.

Second way is take library ready for use (on github or else), e.g. this one.

Upvotes: 1

Related Questions