mirror of
https://github.com/nodejs/node.git
synced 2024-11-21 21:19:50 +01: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>
30 lines
748 B
JavaScript
30 lines
748 B
JavaScript
'use strict';
|
|
|
|
const common = require('../common');
|
|
if (!common.hasCrypto)
|
|
common.skip('missing crypto');
|
|
|
|
const assert = require('assert');
|
|
const {
|
|
generateKeyPair,
|
|
} = require('crypto');
|
|
|
|
// Passing an empty passphrase string should not throw ERR_OSSL_CRYPTO_MALLOC_FAILURE even on OpenSSL 3.
|
|
// Regression test for https://github.com/nodejs/node/issues/41428.
|
|
generateKeyPair('rsa', {
|
|
modulusLength: 1024,
|
|
publicKeyEncoding: {
|
|
type: 'spki',
|
|
format: 'pem'
|
|
},
|
|
privateKeyEncoding: {
|
|
type: 'pkcs8',
|
|
format: 'pem',
|
|
cipher: 'aes-256-cbc',
|
|
passphrase: ''
|
|
}
|
|
}, common.mustSucceed((publicKey, privateKey) => {
|
|
assert.strictEqual(typeof publicKey, 'string');
|
|
assert.strictEqual(typeof privateKey, 'string');
|
|
}));
|