ECSignature: add missing tests for R,S length
This commit is contained in:
parent
a5a9a96ba2
commit
63ce1fdfb2
2 changed files with 9 additions and 1 deletions
|
@ -42,7 +42,7 @@ ECSignature.fromDER = function(buffer) {
|
||||||
assert.equal(buffer.readUInt8(offset), 0x02, 'Expected a DER integer (2)')
|
assert.equal(buffer.readUInt8(offset), 0x02, 'Expected a DER integer (2)')
|
||||||
|
|
||||||
var sLen = buffer.readUInt8(offset + 1)
|
var sLen = buffer.readUInt8(offset + 1)
|
||||||
assert(sLen > 0, 'R length is zero')
|
assert(sLen > 0, 'S length is zero')
|
||||||
|
|
||||||
var rB = buffer.slice(4, offset)
|
var rB = buffer.slice(4, offset)
|
||||||
var sB = buffer.slice(offset + 2)
|
var sB = buffer.slice(offset + 2)
|
||||||
|
|
8
test/fixtures/ecsignature.json
vendored
8
test/fixtures/ecsignature.json
vendored
|
@ -149,6 +149,14 @@
|
||||||
"exception": "Invalid DER encoding",
|
"exception": "Invalid DER encoding",
|
||||||
"hex": "300c020400ffffff020200ffffff"
|
"hex": "300c020400ffffff020200ffffff"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"exception": "R length is zero",
|
||||||
|
"hex": "30080200020400ffffff"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"exception": "S length is zero",
|
||||||
|
"hex": "3008020400ffffff0200"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"exception": "R value is negative",
|
"exception": "R value is negative",
|
||||||
"hex": "300c0204ffffffff020400ffffff"
|
"hex": "300c0204ffffffff020400ffffff"
|
||||||
|
|
Loading…
Reference in a new issue