Lines Matching defs:const

2 const common = require('../common');
6 const assert = require('assert');
7 const fs = require('fs');
8 const path = require('path');
9 const exec = require('child_process').exec;
10 const crypto = require('crypto');
11 const fixtures = require('../common/fixtures');
14 const certPem = fixtures.readKey('rsa_cert.crt');
15 const keyPem = fixtures.readKey('rsa_private.pem');
16 const keySize = 2048;
19 const Sign = crypto.Sign;
20 const instance = Sign('SHA256');
26 const Verify = crypto.Verify;
27 const instance = Verify('SHA256');
34 const library = {
51 const errorStack = {
97 const s1 = crypto.createSign('SHA1')
105 const verified = crypto.createVerify('SHA1')
113 const s2 = crypto.createSign('SHA256')
127 const verStream = crypto.createVerify('SHA256');
136 const s3 = crypto.createSign('SHA1')
145 const verStream = crypto.createVerify('SHA1');
157 const max = keySize / 8 - hLen - 2;
170 const signSaltLengths = [
178 const verifySaltLengths = [
184 const errMessage = /^Error:.*data too large for key size$/;
186 const data = Buffer.from('Test123');
209 const s4 = crypto.createSign(algo)
216 const s4_2 = crypto.sign(algo, data, {
239 const saltLengthCorrect = getEffectiveSaltLength(signSaltLength) ===
260 const wrongData = Buffer.from('Test1234');
288 const verified = crypto.createVerify('SHA1')
298 const examples = JSON.parse(fixtures.readSync('pss-vectors.json', 'utf8'));
300 for (const key in examples) {
301 const example = examples[key];
302 const publicKey = example.publicKey.join('\n');
368 const sign = crypto.createSign('SHA1');
369 const verify = crypto.createVerify('SHA1');
372 const errObj = {
399 const errObj = {
432 const algo = pair.algo;
435 const data = Buffer.from('Hello world');
436 const sig = crypto.sign(algo, data, pair.private);
446 const data = Buffer.from('Hello world');
447 const privKeyObj = crypto.createPrivateKey(pair.private);
448 const pubKeyObj = crypto.createPublicKey(pair.public);
450 const sig = crypto.sign(algo, data, privKeyObj);
458 const data = Buffer.from('Hello world');
459 const otherData = Buffer.from('Goodbye world');
460 const otherSig = crypto.sign(algo, otherData, pair.private);
468 const data = new clazz();
469 const sig = crypto.sign(algo, data, pair.private);
476 const data = Buffer.alloc(1);
477 const sig = Buffer.alloc(1);
478 const errObj = {
496 const data = Buffer.from('Hello world');
497 const keys = [['ec-key.pem', 64], ['dsa_private_1025.pem', 40]];
499 for (const [file, length] of keys) {
500 const privKey = fixtures.readKey(file);
517 const opts = { key: privKey, dsaEncoding: 'ieee-p1363' };
527 for (const i of [-2, -1, 1, 2, 4, 8]) {
542 const extSig = Buffer.from('494c18ab5c8a62a72aea5041966902bcfa229821af2bf65' +
545 for (const ok of [true, false]) {
566 const sig = crypto.sign('sha1', data, {
586 for (const dsaEncoding of ['foo', null, {}, 5, true, NaN]) {
606 const pubfile = fixtures.path('keys', 'rsa_public_2048.pem');
607 const privkey = fixtures.readKey('rsa_private_2048.pem');
609 const msg = 'Test123';
610 const s5 = crypto.createSign('SHA256')
617 const tmpdir = require('../common/tmpdir');
620 const sigfile = path.join(tmpdir.path, 's5.sig');
622 const msgfile = path.join(tmpdir.path, 's5.msg');
625 const cmd =
640 const publicPem = fixtures.readKey('rsa_pss_public_2048.pem');
641 const privatePem = fixtures.readKey('rsa_pss_private_2048.pem');
643 const publicKey = crypto.createPublicKey(publicPem);
644 const privateKey = crypto.createPrivateKey(privatePem);
646 for (const key of [privatePem, privateKey]) {
648 for (const algo of ['sha1', 'sha256']) {
650 for (const saltLength of [undefined, 8, 10, 12, 16, 18, 20]) {
651 const signature = crypto.sign(algo, 'foo', { key, saltLength });
653 for (const pkey of [key, publicKey, publicPem]) {
654 const okay = crypto.verify(
671 const publicPem =
673 const privatePem =
676 const publicKey = crypto.createPublicKey(publicPem);
677 const privateKey = crypto.createPrivateKey(privatePem);
679 for (const key of [privatePem, privateKey]) {
686 for (const saltLength of [8, 10, 12]) {
693 for (const saltLength of [undefined, 16, 18, 20]) {
694 const signature = crypto.sign('sha256', 'foo', { key, saltLength });
696 for (const pkey of [key, publicKey, publicPem]) {
697 const okay = crypto.verify(
713 const publicPem =
715 const privatePem =
718 const publicKey = crypto.createPublicKey(publicPem);
719 const privateKey = crypto.createPrivateKey(privatePem);
725 for (const key of [privatePem, privateKey]) {
728 for (const algo of ['sha1', 'sha256']) {
735 const signature = crypto.sign('sha512', 'foo', key);
737 for (const pkey of [key, publicKey, publicPem]) {
738 const okay = crypto.verify('sha512', 'foo', pkey, signature);
750 const { privateKey } = crypto.generateKeyPairSync('rsa', {
762 for (const key of ['', 'foo', null, undefined, true, Boolean]) {