mirror of
https://github.com/nodejs/node.git
synced 2026-11-09 15:11:11 -05:00
Signed-off-by: Filip Skokan <panva.ip@gmail.com> PR-URL: https://github.com/nodejs/node/pull/64960 Fixes: https://github.com/nodejs/node/issues/48379 Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Aviv Keller <me@aviv.sh>
18 lines
605 B
JavaScript
18 lines
605 B
JavaScript
'use strict';
|
|
const common = require('../common');
|
|
if (!common.hasCrypto)
|
|
common.skip('missing crypto');
|
|
|
|
const assert = require('assert');
|
|
const crypto = require('crypto');
|
|
const { hasFIPS } = require('../common/crypto');
|
|
|
|
const group = hasFIPS(3) ? 'modp14' : 'modp5';
|
|
const alice = crypto.createDiffieHellmanGroup(group);
|
|
const bob = crypto.createDiffieHellmanGroup(group);
|
|
alice.generateKeys();
|
|
bob.generateKeys();
|
|
const aSecret = alice.computeSecret(bob.getPublicKey()).toString('hex');
|
|
const bSecret = bob.computeSecret(alice.getPublicKey()).toString('hex');
|
|
assert.strictEqual(aSecret, bSecret);
|