mirror of
https://github.com/nodejs/node.git
synced 2024-11-21 10:59:27 +00:00
7224940e54
To avoid timing out on ARM machines in the CI. 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>
40 lines
1.2 KiB
JavaScript
40 lines
1.2 KiB
JavaScript
'use strict';
|
|
|
|
const common = require('../common');
|
|
if (!common.hasCrypto)
|
|
common.skip('missing crypto');
|
|
|
|
const assert = require('assert');
|
|
const {
|
|
generateKeyPair,
|
|
} = require('crypto');
|
|
|
|
// This tests check that generateKeyPair returns correct bit length in
|
|
// KeyObject's asymmetricKeyDetails.
|
|
// https://github.com/nodejs/node/issues/46102#issuecomment-1372153541
|
|
{
|
|
generateKeyPair('rsa', {
|
|
modulusLength: 513,
|
|
}, common.mustSucceed((publicKey, privateKey) => {
|
|
assert.strictEqual(privateKey.asymmetricKeyDetails.modulusLength, 513);
|
|
assert.strictEqual(publicKey.asymmetricKeyDetails.modulusLength, 513);
|
|
}));
|
|
|
|
generateKeyPair('rsa-pss', {
|
|
modulusLength: 513,
|
|
}, common.mustSucceed((publicKey, privateKey) => {
|
|
assert.strictEqual(privateKey.asymmetricKeyDetails.modulusLength, 513);
|
|
assert.strictEqual(publicKey.asymmetricKeyDetails.modulusLength, 513);
|
|
}));
|
|
|
|
if (common.hasOpenSSL3) {
|
|
generateKeyPair('dsa', {
|
|
modulusLength: 2049,
|
|
divisorLength: 256,
|
|
}, common.mustSucceed((publicKey, privateKey) => {
|
|
assert.strictEqual(privateKey.asymmetricKeyDetails.modulusLength, 2049);
|
|
assert.strictEqual(publicKey.asymmetricKeyDetails.modulusLength, 2049);
|
|
}));
|
|
}
|
|
}
|