mirror of
https://github.com/nodejs/node.git
synced 2024-11-21 10:59:27 +00:00
b781eaf430
PR-URL: https://github.com/nodejs/node/pull/49221 Refs: https://github.com/nodejs/node/issues/49202 Refs: https://github.com/nodejs/node/issues/41206 Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
24 lines
574 B
JavaScript
24 lines
574 B
JavaScript
'use strict';
|
|
|
|
const common = require('../common');
|
|
if (!common.hasCrypto)
|
|
common.skip('missing crypto');
|
|
|
|
const assert = require('assert');
|
|
const {
|
|
generateKeyPair,
|
|
} = require('crypto');
|
|
|
|
// Test classic Diffie-Hellman key generation.
|
|
{
|
|
generateKeyPair('dh', {
|
|
primeLength: 512
|
|
}, common.mustSucceed((publicKey, privateKey) => {
|
|
assert.strictEqual(publicKey.type, 'public');
|
|
assert.strictEqual(publicKey.asymmetricKeyType, 'dh');
|
|
|
|
assert.strictEqual(privateKey.type, 'private');
|
|
assert.strictEqual(privateKey.asymmetricKeyType, 'dh');
|
|
}));
|
|
}
|