Browse Source

ECSignature: avoid multiple push/unshift operations

hk-custom-address
Daniel Cousens 11 years ago
parent
commit
656de37fc0
  1. 13
      src/ecsignature.js

13
src/ecsignature.js

@ -98,16 +98,17 @@ ECSignature.prototype.toDER = function() {
var sBa = this.s.toDERInteger() var sBa = this.s.toDERInteger()
var sequence = [] var sequence = []
sequence.push(0x02) // INTEGER
sequence.push(rBa.length) // INTEGER
sequence.push(0x02, rBa.length)
sequence = sequence.concat(rBa) sequence = sequence.concat(rBa)
sequence.push(0x02) // INTEGER // INTEGER
sequence.push(sBa.length) sequence.push(0x02, sBa.length)
sequence = sequence.concat(sBa) sequence = sequence.concat(sBa)
sequence.unshift(sequence.length) // SEQUENCE
sequence.unshift(0x30) // SEQUENCE sequence.unshift(0x30, sequence.length)
return new Buffer(sequence) return new Buffer(sequence)
} }

Loading…
Cancel
Save