diff --git a/algos.js b/algos.js index e2dd3d9..7758cd2 100644 --- a/algos.js +++ b/algos.js @@ -33,22 +33,22 @@ exports.DSA = exports['DSA-SHA1'] = exports['DSA-SHA'] = { hash: 'sha1', id: new Buffer('', 'hex') }; -exports['DSA-SHA224'] = { +exports['DSA-SHA224'] = exports['DSA-WITH-SHA224'] = { sign: 'dsa', hash: 'sha224', id: new Buffer('', 'hex') }; -exports['DSA-SHA256'] = { +exports['DSA-SHA256'] = exports['DSA-WITH-SHA256'] = { sign: 'dsa', hash: 'sha256', id: new Buffer('', 'hex') }; -exports['DSA-SHA384'] = { +exports['DSA-SHA384'] = exports['DSA-WITH-SHA384'] = { sign: 'dsa', hash: 'sha384', id: new Buffer('', 'hex') }; -exports['DSA-SHA512'] = { +exports['DSA-SHA512'] = exports['DSA-WITH-SHA512'] = { sign: 'dsa', hash: 'sha512', id: new Buffer('', 'hex') diff --git a/sign.js b/sign.js index a886272..dae5f61 100644 --- a/sign.js +++ b/sign.js @@ -122,7 +122,13 @@ function bits2int(obits, q) { function bits2octets (bits, q) { bits = bits2int(bits, q); bits = bits.mod(q); - return new Buffer(bits.toArray()); + var out = new Buffer(bits.toArray()); + if (out.length < q.byteLength()) { + var zeros = new Buffer(q.byteLength() - out.length); + zeros.fill(0); + out = Buffer.concat([zeros, out]); + } + return out; } module.exports.makeKey = makeKey; function makeKey(q, kv, algo, crypto) {