Skip to content

Commit

Permalink
Allow an RSA-SHA signer to use an ECDSA key
Browse files Browse the repository at this point in the history
Such behaviour is expected from Node's crypto implementation, as can
be seen there: https://github.com/brianloveswords/node-jwa/blob/master/index.js#L51
  • Loading branch information
pgaubatz committed Oct 10, 2015
1 parent 555b793 commit 0dd151d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion sign.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ var EC = elliptic.ec
function sign (hash, key, hashType, signType) {
var priv = parseKeys(key)
if (priv.curve) {
if (signType !== 'ecdsa') throw new Error('wrong private key type')
if (signType !== 'ecdsa' && signType !== 'rsa') throw new Error('wrong private key type')

return ecSign(hash, priv)
} else if (priv.type === 'dsa') {
Expand Down

0 comments on commit 0dd151d

Please sign in to comment.