Skip to content
Permalink
Browse files

test: remove string literal from assertions

PR-URL: #19276
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Yuta Hiroto <hello@hiroppy.me>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
  • Loading branch information...
Nate-weeks authored and tniessen committed Mar 10, 2018
1 parent 42d8ea0 commit 92de0eb4197c951703aeb4759a3ef9c6897c10ee
Showing with 9 additions and 9 deletions.
  1. +9 −9 test/parallel/test-crypto-sign-verify.js
@@ -65,7 +65,7 @@ common.expectsError(
.update('Test')
.update('123')
.verify(certPem, s1, 'base64');
assert.strictEqual(verified, true, 'sign and verify (base 64)');
assert.strictEqual(verified, true);
}

{
@@ -81,14 +81,14 @@ common.expectsError(
.update('Test')
.update('123')
.verify(certPem, s2, 'latin1');
assert.strictEqual(verified, true, 'sign and verify (latin1)');
assert.strictEqual(verified, true);

const verStream = crypto.createVerify('SHA256');
verStream.write('Tes');
verStream.write('t12');
verStream.end('3');
verified = verStream.verify(certPem, s2, 'latin1');
assert.strictEqual(verified, true, 'sign and verify (stream)');
assert.strictEqual(verified, true);
}

{
@@ -99,14 +99,14 @@ common.expectsError(
.update('Test')
.update('123')
.verify(certPem, s3);
assert.strictEqual(verified, true, 'sign and verify (buffer)');
assert.strictEqual(verified, true);

const verStream = crypto.createVerify('SHA1');
verStream.write('Tes');
verStream.write('t12');
verStream.end('3');
verified = verStream.verify(certPem, s3);
assert.strictEqual(verified, true, 'sign and verify (stream)');
assert.strictEqual(verified, true);
}

// Special tests for RSA_PKCS1_PSS_PADDING
@@ -177,7 +177,7 @@ common.expectsError(
}, s4);
const saltLengthCorrect = getEffectiveSaltLength(signSaltLength) ===
getEffectiveSaltLength(verifySaltLength);
assert.strictEqual(verified, saltLengthCorrect, 'verify (PSS)');
assert.strictEqual(verified, saltLengthCorrect);
});

// Verification using RSA_PSS_SALTLEN_AUTO should always work
@@ -188,7 +188,7 @@ common.expectsError(
padding: crypto.constants.RSA_PKCS1_PSS_PADDING,
saltLength: crypto.constants.RSA_PSS_SALTLEN_AUTO
}, s4);
assert.strictEqual(verified, true, 'verify (PSS with SALTLEN_AUTO)');
assert.strictEqual(verified, true);

// Verifying an incorrect message should never work
verified = crypto.createVerify(algo)
@@ -198,7 +198,7 @@ common.expectsError(
padding: crypto.constants.RSA_PKCS1_PSS_PADDING,
saltLength: crypto.constants.RSA_PSS_SALTLEN_AUTO
}, s4);
assert.strictEqual(verified, false, 'verify (PSS, incorrect)');
assert.strictEqual(verified, false);
}
});
}
@@ -219,7 +219,7 @@ common.expectsError(
padding: crypto.constants.RSA_PKCS1_PSS_PADDING,
saltLength: vector.salt.length / 2
}, vector.signature, 'hex');
assert.strictEqual(verified, true, 'verify (PSS)');
assert.strictEqual(verified, true);
}

const examples = JSON.parse(fixtures.readSync('pss-vectors.json', 'utf8'));

0 comments on commit 92de0eb

Please sign in to comment.
You can’t perform that action at this time.