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 browserify#37.
  • Loading branch information
kapouer authored and ljharb committed Jan 3, 2018
1 parent f5f17c2 commit f542dde
Showing 1 changed file with 18 additions and 3 deletions.
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 f542dde

Please sign in to comment.