ECSignature: avoid multiple push/unshift operations
This commit is contained in:
parent
dcc9ddff08
commit
656de37fc0
1 changed files with 7 additions and 6 deletions
|
@ -98,16 +98,17 @@ ECSignature.prototype.toDER = function() {
|
|||
var sBa = this.s.toDERInteger()
|
||||
|
||||
var sequence = []
|
||||
sequence.push(0x02) // INTEGER
|
||||
sequence.push(rBa.length)
|
||||
|
||||
// INTEGER
|
||||
sequence.push(0x02, rBa.length)
|
||||
sequence = sequence.concat(rBa)
|
||||
|
||||
sequence.push(0x02) // INTEGER
|
||||
sequence.push(sBa.length)
|
||||
// INTEGER
|
||||
sequence.push(0x02, sBa.length)
|
||||
sequence = sequence.concat(sBa)
|
||||
|
||||
sequence.unshift(sequence.length)
|
||||
sequence.unshift(0x30) // SEQUENCE
|
||||
// SEQUENCE
|
||||
sequence.unshift(0x30, sequence.length)
|
||||
|
||||
return new Buffer(sequence)
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue