Skip to content

Commit

Permalink
[Tests] log when openssl doesn't support cipher
Browse files Browse the repository at this point in the history
This fixes #37.
  • Loading branch information
kapouer authored and ljharb committed Jan 3, 2018
1 parent f5f17c2 commit 5f6fb17
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 4 deletions.
7 changes: 6 additions & 1 deletion .eslintrc
Expand Up @@ -33,12 +33,17 @@
"files": "browser/sign.js",
"rules": {
"max-params": "off",
// "max-statements": "off",
"max-statements-per-line": "off",
"no-param-reassign": "warn",
"no-plusplus": "warn",
"no-use-before-define": "warn",
}
},
{
"files": "test/*.js",
"rules": {
"max-lines-per-function": "off",
},
},
],
}
21 changes: 18 additions & 3 deletions test/index.js
Expand Up @@ -28,7 +28,6 @@ fixtures.valid.rsa.forEach(function (f) {
priv = Buffer.from(f['private'], 'base64');
}

console.log(nCrypto.getHashes());
(nCrypto.getHashes().indexOf(f.scheme) >= 0 ? test : test.skip)(f.message, function (t) {
var bSign;
try {
Expand Down Expand Up @@ -82,8 +81,23 @@ fixtures.valid.ec.forEach(function (f) {
}

(nCrypto.getHashes().indexOf(f.scheme) >= 0 ? test : test.skip)(f.message, function (t) {
var nSign = nCrypto.createSign(f.scheme);
var bSign = bCrypto.createSign(f.scheme);
var nSign;
try {
nSign = nCrypto.createSign(f.scheme);
} catch (e) {
console.info('skipping unsupported browserify-sign scheme', f.scheme);
t.end();
return;
}

var bSign;
try {
bSign = bCrypto.createSign(f.scheme);
} catch (e) {
console.info('skipping unsupported node scheme', f.scheme);
t.end();
return;
}

var bSig = bSign.update(message).sign(priv);
var nSig = nSign.update(message).sign(priv);
Expand All @@ -98,6 +112,7 @@ fixtures.valid.ec.forEach(function (f) {

t.end();
});

if (f.scheme !== 'DSA' && f.scheme.toLowerCase().indexOf('dsa') === -1) {
test(f.message + ' named rsa through', function (t) {
var scheme = 'RSA-' + f.scheme.toUpperCase();
Expand Down

0 comments on commit 5f6fb17

Please sign in to comment.