mirror of
https://github.com/nodejs/node.git
synced 2026-10-28 18:25:13 +08:00
Add isBoringSSL to the test crypto helpers and use it in tests and benchmarks. Replace hasOpenSSL3 call sites with hasOpenSSL(3). Assisted-by: Codex Signed-off-by: Filip Skokan <panva.ip@gmail.com> PR-URL: https://github.com/nodejs/node/pull/65762 Reviewed-By: Richard Lau <richard.lau@ibm.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Gürgün Dayıoğlu <hey@gurgun.day>
37 lines
787 B
JavaScript
37 lines
787 B
JavaScript
'use strict';
|
|
|
|
const common = require('../common');
|
|
if (!common.hasCrypto)
|
|
common.skip('missing crypto');
|
|
|
|
const { isBoringSSL, hasFIPS } = require('../common/crypto');
|
|
|
|
if (isBoringSSL)
|
|
common.skip('BoringSSL does not support DSA key pair generation');
|
|
|
|
const assert = require('assert');
|
|
|
|
const {
|
|
generateKeyPairSync,
|
|
} = require('crypto');
|
|
|
|
const fips3 = hasFIPS(3);
|
|
|
|
// Test invalid parameter encoding.
|
|
{
|
|
assert.throws(() => generateKeyPairSync('dsa', {
|
|
modulusLength: 1024,
|
|
publicKeyEncoding: {
|
|
format: 'jwk'
|
|
},
|
|
privateKeyEncoding: {
|
|
format: 'jwk'
|
|
}
|
|
}), {
|
|
name: 'Error',
|
|
code: fips3 ? 'ERR_OSSL_DSA_BAD_FFC_PARAMETERS' :
|
|
'ERR_CRYPTO_JWK_UNSUPPORTED_KEY_TYPE',
|
|
...!fips3 && { message: 'Unsupported JWK Key Type.' },
|
|
});
|
|
}
|