Skip to content

Commit

Permalink
fixup per mscdex
Browse files Browse the repository at this point in the history
  • Loading branch information
Trott committed Jan 31, 2016
1 parent 48703e6 commit ed465ab
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 23 deletions.
24 changes: 12 additions & 12 deletions test/parallel/test-crypto-binary-default.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ assert.throws(function() {

// Test HMAC
const hmacHash = crypto.createHmac('sha1', 'Node')
.update('some data')
.update('to hmac')
.digest('hex');
.update('some data')
.update('to hmac')
.digest('hex');
assert.equal(hmacHash, '19fd6e1ba73d9ed2224dd5094a71babe85d9a892', 'test HMAC');

// Test HMAC-SHA-* (rfc 4231 Test Cases)
Expand Down Expand Up @@ -395,27 +395,27 @@ var s1 = crypto.createSign('RSA-SHA1')
.update('Test123')
.sign(keyPem, 'base64');
var s1Verified = crypto.createVerify('RSA-SHA1')
.update('Test')
.update('123')
.verify(certPem, s1, 'base64');
.update('Test')
.update('123')
.verify(certPem, s1, 'base64');
assert.strictEqual(s1Verified, true, 'sign and verify (base 64)');

var s2 = crypto.createSign('RSA-SHA256')
.update('Test123')
.sign(keyPem); // binary
var s2Verified = crypto.createVerify('RSA-SHA256')
.update('Test')
.update('123')
.verify(certPem, s2); // binary
.update('Test')
.update('123')
.verify(certPem, s2); // binary
assert.strictEqual(s2Verified, true, 'sign and verify (binary)');

var s3 = crypto.createSign('RSA-SHA1')
.update('Test123')
.sign(keyPem, 'buffer');
var s3Verified = crypto.createVerify('RSA-SHA1')
.update('Test')
.update('123')
.verify(certPem, s3);
.update('Test')
.update('123')
.verify(certPem, s3);
assert.strictEqual(s3Verified, true, 'sign and verify (buffer)');


Expand Down
4 changes: 2 additions & 2 deletions test/parallel/test-crypto-hmac.js
Original file line number Diff line number Diff line change
Expand Up @@ -227,8 +227,8 @@ for (let i = 0, l = rfc4231.length; i < l; i++) {
str.end(rfc4231[i].data);
let strRes = str.read().toString('hex');
let result = crypto.createHmac(hash, rfc4231[i]['key'])
.update(rfc4231[i]['data'])
.digest('hex');
.update(rfc4231[i]['data'])
.digest('hex');
if (rfc4231[i]['truncate']) {
result = result.substr(0, 32); // first 128 bits == 32 hex chars
strRes = strRes.substr(0, 32);
Expand Down
18 changes: 9 additions & 9 deletions test/parallel/test-crypto-sign-verify.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,24 +16,24 @@ var keyPem = fs.readFileSync(common.fixturesDir + '/test_key.pem', 'ascii');
// Test signing and verifying
{
const s1 = crypto.createSign('RSA-SHA1')
.update('Test123')
.sign(keyPem, 'base64');
.update('Test123')
.sign(keyPem, 'base64');
let s1stream = crypto.createSign('RSA-SHA1');
s1stream.end('Test123');
s1stream = s1stream.sign(keyPem, 'base64');
assert.equal(s1, s1stream, 'Stream produces same output');

const verified = crypto.createVerify('RSA-SHA1')
.update('Test')
.update('123')
.verify(certPem, s1, 'base64');
.update('Test')
.update('123')
.verify(certPem, s1, 'base64');
assert.strictEqual(verified, true, 'sign and verify (base 64)');
}

{
const s2 = crypto.createSign('RSA-SHA256')
.update('Test123')
.sign(keyPem, 'binary');
.update('Test123')
.sign(keyPem, 'binary');
let s2stream = crypto.createSign('RSA-SHA256');
s2stream.end('Test123');
s2stream = s2stream.sign(keyPem, 'binary');
Expand All @@ -55,8 +55,8 @@ var keyPem = fs.readFileSync(common.fixturesDir + '/test_key.pem', 'ascii');

{
const s3 = crypto.createSign('RSA-SHA1')
.update('Test123')
.sign(keyPem, 'buffer');
.update('Test123')
.sign(keyPem, 'buffer');
let verified = crypto.createVerify('RSA-SHA1')
.update('Test')
.update('123')
Expand Down

0 comments on commit ed465ab

Please sign in to comment.