Lines Matching refs:crypto
7 const crypto = require('crypto'); constant
9 assert.throws(() => crypto.diffieHellman(), {
18 const buf1 = crypto.diffieHellman({
22 const buf2 = crypto.diffieHellman({
32 const alicePrivateKey = crypto.createPrivateKey({
47 const alicePublicKey = crypto.createPublicKey({
62 const bobPrivateKey = crypto.createPrivateKey({
77 const bobPublicKey = crypto.createPublicKey({
92 assert.throws(() => crypto.diffieHellman({ privateKey: alicePrivateKey }), {
98 assert.throws(() => crypto.diffieHellman({ publicKey: alicePublicKey }), {
119 const group = crypto.getDiffieHellman('modp5');
120 const dh = crypto.createDiffieHellman(group.getPrime(), group.getGenerator());
129 test(crypto.generateKeyPairSync('dh', { group: 'modp5' }),
130 crypto.generateKeyPairSync('dh', { group: 'modp5' }));
132 test(crypto.generateKeyPairSync('dh', { group: 'modp5' }),
133 crypto.generateKeyPairSync('dh', { prime: group.getPrime() }));
144 test(crypto.generateKeyPairSync('dh', params1),
145 crypto.generateKeyPairSync('dh', params2));
153 const privateKey = crypto.createPrivateKey({
166 const publicKey = crypto.createPublicKey({
183 const secret = crypto.diffieHellman({ publicKey, privateKey });
196 test(crypto.generateKeyPairSync('ec', { namedCurve: 'secp256k1' }),
197 crypto.generateKeyPairSync('ec', { namedCurve: 'secp256k1' }));
199 const not256k1 = crypto.getCurves().find((c) => /^sec.*(224|384|512)/.test(c));
201 test(crypto.generateKeyPairSync('ec', { namedCurve: 'secp256k1' }),
202 crypto.generateKeyPairSync('ec', { namedCurve: not256k1 }));
210 test(crypto.generateKeyPairSync('x448'),
211 crypto.generateKeyPairSync('x448'));
213 test(crypto.generateKeyPairSync('x25519'),
214 crypto.generateKeyPairSync('x25519'));
217 test(crypto.generateKeyPairSync('x448'),
218 crypto.generateKeyPairSync('x25519'));