Skip to content

Commit

Permalink
amend ECSignature tests to reflect BIP66 module
Browse files Browse the repository at this point in the history
  • Loading branch information
dcousens committed Aug 21, 2015
1 parent 1e23085 commit e1cb5e6
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 20 deletions.
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -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",
Expand Down
4 changes: 1 addition & 3 deletions test/bitcoin.core.js
Expand Up @@ -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/)
})
})
})
Expand Down
36 changes: 20 additions & 16 deletions test/fixtures/ecsignature.json
Expand Up @@ -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"
Expand All @@ -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",
Expand Down

0 comments on commit e1cb5e6

Please sign in to comment.