Skip to content

Commit 5f6fb17

Browse files
kapouerljharb
authored andcommittedJan 3, 2018
[Tests] log when openssl doesn't support cipher
This fixes #37.
1 parent f5f17c2 commit 5f6fb17

File tree

2 files changed

+24
-4
lines changed

2 files changed

+24
-4
lines changed
 

‎.eslintrc

+6-1
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,17 @@
3333
"files": "browser/sign.js",
3434
"rules": {
3535
"max-params": "off",
36-
// "max-statements": "off",
3736
"max-statements-per-line": "off",
3837
"no-param-reassign": "warn",
3938
"no-plusplus": "warn",
4039
"no-use-before-define": "warn",
4140
}
4241
},
42+
{
43+
"files": "test/*.js",
44+
"rules": {
45+
"max-lines-per-function": "off",
46+
},
47+
},
4348
],
4449
}

‎test/index.js

+18-3
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ fixtures.valid.rsa.forEach(function (f) {
2828
priv = Buffer.from(f['private'], 'base64');
2929
}
3030

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

8483
(nCrypto.getHashes().indexOf(f.scheme) >= 0 ? test : test.skip)(f.message, function (t) {
85-
var nSign = nCrypto.createSign(f.scheme);
86-
var bSign = bCrypto.createSign(f.scheme);
84+
var nSign;
85+
try {
86+
nSign = nCrypto.createSign(f.scheme);
87+
} catch (e) {
88+
console.info('skipping unsupported browserify-sign scheme', f.scheme);
89+
t.end();
90+
return;
91+
}
92+
93+
var bSign;
94+
try {
95+
bSign = bCrypto.createSign(f.scheme);
96+
} catch (e) {
97+
console.info('skipping unsupported node scheme', f.scheme);
98+
t.end();
99+
return;
100+
}
87101

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

99113
t.end();
100114
});
115+
101116
if (f.scheme !== 'DSA' && f.scheme.toLowerCase().indexOf('dsa') === -1) {
102117
test(f.message + ' named rsa through', function (t) {
103118
var scheme = 'RSA-' + f.scheme.toUpperCase();

0 commit comments

Comments
 (0)
Please sign in to comment.