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 75ce1d5 commit 42e1970
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions test/index.js
Expand Up @@ -66,9 +66,15 @@ fixtures.valid.ec.forEach(function (f) {
}

(nCrypto.getHashes().includes(f.scheme) ? test : test.skip)(f.message, function (t) {
var nSign = nCrypto.createSign(f.scheme);
var nSign;
try {
nSign = nCrypto.createSign(f.scheme);
} catch (ex) {
console.info('skipping unsupported scheme', f.scheme);
t.end();
return;
}
var bSign = bCrypto.createSign(f.scheme);

var bSig = bSign.update(message).sign(priv);
var nSig = nSign.update(message).sign(priv);
t.notEqual(bSig.toString('hex'), nSig.toString('hex'), 'not equal sigs');
Expand All @@ -82,6 +88,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 42e1970

Please sign in to comment.