amend ECSignature tests to reflect BIP66 module

This commit is contained in:
Daniel Cousens 2015-08-21 20:39:24 +10:00
parent 1e23085ad7
commit e1cb5e6152
3 changed files with 22 additions and 20 deletions

View file

@ -46,7 +46,7 @@
},
"dependencies": {
"bigi": "^1.4.0",
"bip66": "^1.0.2",
"bip66": "^1.0.8",
"bs58check": "^1.0.5",
"create-hash": "^1.1.0",
"create-hmac": "^1.1.3",

View file

@ -243,14 +243,12 @@ describe('Bitcoin-core', function () {
if (i % 2 !== 0) return
var description = sig_noncanonical[i - 1].slice(0, -1)
if (description === 'too long') return // we support non secp256k1 signatures
var buffer = new Buffer(hex, 'hex')
it('throws on ' + description, function () {
assert.throws(function () {
bitcoin.ECSignature.parseScriptSignature(buffer)
})
}, /Expected DER (integer|sequence)|(R|S) value (excessively padded|is negative)|(R|S|DER sequence) length is (zero|too short|too long|invalid)|Invalid hashType/)
})
})
})

View file

@ -130,37 +130,33 @@
],
"DER": [
{
"exception": "DER sequence too short",
"exception": "DER sequence length is too short",
"hex": "ffffffffffffff"
},
{
"exception": "DER sequence too long",
"exception": "DER sequence length is too long",
"hex": "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
},
{
"exception": "Invalid sequence length",
"exception": "Expected DER sequence",
"hex": "00ffff0400ffffff020400ffffff"
},
{
"exception": "DER sequence length is invalid",
"hex": "30ff020400ffffff020400ffffff"
},
{
"exception": "Invalid sequence length",
"exception": "DER sequence length is invalid",
"hex": "300c030400ffffff030400ffffff0000"
},
{
"exception": "Expected a DER integer",
"exception": "Expected DER integer",
"hex": "300cff0400ffffff020400ffffff"
},
{
"exception": "Expected a DER integer \\(2\\)",
"exception": "Expected DER integer \\(2\\)",
"hex": "300c020200ffffff020400ffffff"
},
{
"exception": "Invalid DER encoding",
"hex": "300c0204ddffffff020200ffffff"
},
{
"exception": "Invalid DER encoding \\(2\\)",
"hex": "300c020400ffffff02dd00ffffff"
},
{
"exception": "R length is zero",
"hex": "30080200020400ffffff"
@ -169,13 +165,21 @@
"exception": "S length is zero",
"hex": "3008020400ffffff0200"
},
{
"exception": "R length is too long",
"hex": "300c02dd00ffffff020400ffffff"
},
{
"exception": "S length is invalid",
"hex": "300c020400ffffff02dd00ffffff"
},
{
"exception": "R value is negative",
"hex": "300c0204ffffffff020400ffffff"
"hex": "300c020480000000020400ffffff"
},
{
"exception": "S value is negative",
"hex": "300c020400ffffff0204ffffffff"
"hex": "300c020400ffffff020480000000"
},
{
"exception": "R value excessively padded",