mirror of
https://github.com/nodejs/node.git
synced 2025-05-07 23:52:40 +00:00

The `crypto.Credentials` legacy API has been Runtime deprecated since v0.11.13 and users had been adviced to use `tls.SecureContext` instead. PR-URL: https://github.com/nodejs/node/pull/21153 Fixes: https://github.com/nodejs/node/issues/20793 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Ujjwal Sharma <usharma1998@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: James M Snell <jasnell@gmail.com>
33 lines
884 B
JavaScript
33 lines
884 B
JavaScript
'use strict';
|
|
const common = require('../common');
|
|
const assert = require('assert');
|
|
|
|
if (!common.hasCrypto) {
|
|
common.skip('missing crypto');
|
|
return;
|
|
}
|
|
const crypto = require('crypto');
|
|
|
|
// 'ClassName' : ['args', 'for', 'constructor']
|
|
const TEST_CASES = {
|
|
'Hash': ['sha1'],
|
|
'Hmac': ['sha1', 'Node'],
|
|
'Cipheriv': ['des-ede3-cbc', '0123456789abcd0123456789', '12345678'],
|
|
'Decipheriv': ['des-ede3-cbc', '0123456789abcd0123456789', '12345678'],
|
|
'Sign': ['RSA-SHA1'],
|
|
'Verify': ['RSA-SHA1'],
|
|
'DiffieHellman': [1024],
|
|
'DiffieHellmanGroup': ['modp5'],
|
|
'ECDH': ['prime256v1'],
|
|
};
|
|
|
|
if (!common.hasFipsCrypto) {
|
|
TEST_CASES.Cipher = ['aes192', 'secret'];
|
|
TEST_CASES.Decipher = ['aes192', 'secret'];
|
|
TEST_CASES.DiffieHellman = [256];
|
|
}
|
|
|
|
for (const [clazz, args] of Object.entries(TEST_CASES)) {
|
|
assert(crypto[`create${clazz}`](...args) instanceof crypto[clazz]);
|
|
}
|