gofmt
This commit is contained in:
parent
58cab817f0
commit
d991c18d16
2 changed files with 37 additions and 37 deletions
|
@ -25,7 +25,7 @@ type pubKeyTest struct {
|
|||
}
|
||||
|
||||
var privKeyTests = []privKeyTest{
|
||||
privKeyTest{
|
||||
{
|
||||
name: "check curve",
|
||||
key: []byte{
|
||||
0xea, 0xf0, 0x2c, 0xa3, 0x48, 0xc5, 0x24, 0xe6,
|
||||
|
@ -39,7 +39,7 @@ var privKeyTests = []privKeyTest{
|
|||
var pubKeyTests = []pubKeyTest{
|
||||
// pubkey from bitcoin blockchain tx
|
||||
// 0437cd7f8525ceed2324359c2d0ba26006d92d85
|
||||
pubKeyTest{
|
||||
{
|
||||
name: "uncompressed ok",
|
||||
key: []byte{0x04, 0x11, 0xdb, 0x93, 0xe1, 0xdc, 0xdb, 0x8a,
|
||||
0x01, 0x6b, 0x49, 0x84, 0x0f, 0x8c, 0x53, 0xbc, 0x1e,
|
||||
|
@ -53,7 +53,7 @@ var pubKeyTests = []pubKeyTest{
|
|||
isValid: true,
|
||||
format: btcec.TstPubkeyUncompressed,
|
||||
},
|
||||
pubKeyTest{
|
||||
{
|
||||
name: "uncompressed x changed",
|
||||
key: []byte{0x04, 0x15, 0xdb, 0x93, 0xe1, 0xdc, 0xdb, 0x8a,
|
||||
0x01, 0x6b, 0x49, 0x84, 0x0f, 0x8c, 0x53, 0xbc, 0x1e,
|
||||
|
@ -66,7 +66,7 @@ var pubKeyTests = []pubKeyTest{
|
|||
},
|
||||
isValid: false,
|
||||
},
|
||||
pubKeyTest{
|
||||
{
|
||||
name: "uncompressed y changed",
|
||||
key: []byte{0x04, 0x11, 0xdb, 0x93, 0xe1, 0xdc, 0xdb, 0x8a,
|
||||
0x01, 0x6b, 0x49, 0x84, 0x0f, 0x8c, 0x53, 0xbc, 0x1e,
|
||||
|
@ -79,7 +79,7 @@ var pubKeyTests = []pubKeyTest{
|
|||
},
|
||||
isValid: false,
|
||||
},
|
||||
pubKeyTest{
|
||||
{
|
||||
name: "uncompressed claims compressed",
|
||||
key: []byte{0x03, 0x11, 0xdb, 0x93, 0xe1, 0xdc, 0xdb, 0x8a,
|
||||
0x01, 0x6b, 0x49, 0x84, 0x0f, 0x8c, 0x53, 0xbc, 0x1e,
|
||||
|
@ -92,7 +92,7 @@ var pubKeyTests = []pubKeyTest{
|
|||
},
|
||||
isValid: false,
|
||||
},
|
||||
pubKeyTest{
|
||||
{
|
||||
name: "uncompressed as hybrid ok",
|
||||
key: []byte{0x07, 0x11, 0xdb, 0x93, 0xe1, 0xdc, 0xdb, 0x8a,
|
||||
0x01, 0x6b, 0x49, 0x84, 0x0f, 0x8c, 0x53, 0xbc, 0x1e,
|
||||
|
@ -106,7 +106,7 @@ var pubKeyTests = []pubKeyTest{
|
|||
isValid: true,
|
||||
format: btcec.TstPubkeyHybrid,
|
||||
},
|
||||
pubKeyTest{
|
||||
{
|
||||
name: "uncompressed as hybrid wrong",
|
||||
key: []byte{0x06, 0x11, 0xdb, 0x93, 0xe1, 0xdc, 0xdb, 0x8a,
|
||||
0x01, 0x6b, 0x49, 0x84, 0x0f, 0x8c, 0x53, 0xbc, 0x1e,
|
||||
|
@ -120,7 +120,7 @@ var pubKeyTests = []pubKeyTest{
|
|||
isValid: false,
|
||||
},
|
||||
// from tx 0b09c51c51ff762f00fb26217269d2a18e77a4fa87d69b3c363ab4df16543f20
|
||||
pubKeyTest{
|
||||
{
|
||||
name: "compressed ok (ybit = 0)",
|
||||
key: []byte{0x02, 0xce, 0x0b, 0x14, 0xfb, 0x84, 0x2b, 0x1b,
|
||||
0xa5, 0x49, 0xfd, 0xd6, 0x75, 0xc9, 0x80, 0x75, 0xf1,
|
||||
|
@ -131,7 +131,7 @@ var pubKeyTests = []pubKeyTest{
|
|||
format: btcec.TstPubkeyCompressed,
|
||||
},
|
||||
// from tx fdeb8e72524e8dab0da507ddbaf5f88fe4a933eb10a66bc4745bb0aa11ea393c
|
||||
pubKeyTest{
|
||||
{
|
||||
name: "compressed ok (ybit = 1)",
|
||||
key: []byte{0x03, 0x26, 0x89, 0xc7, 0xc2, 0xda, 0xb1, 0x33,
|
||||
0x09, 0xfb, 0x14, 0x3e, 0x0e, 0x8f, 0xe3, 0x96, 0x34,
|
||||
|
@ -141,7 +141,7 @@ var pubKeyTests = []pubKeyTest{
|
|||
isValid: true,
|
||||
format: btcec.TstPubkeyCompressed,
|
||||
},
|
||||
pubKeyTest{
|
||||
{
|
||||
name: "compressed claims uncompressed (ybit = 0)",
|
||||
key: []byte{0x04, 0xce, 0x0b, 0x14, 0xfb, 0x84, 0x2b, 0x1b,
|
||||
0xa5, 0x49, 0xfd, 0xd6, 0x75, 0xc9, 0x80, 0x75, 0xf1,
|
||||
|
@ -150,7 +150,7 @@ var pubKeyTests = []pubKeyTest{
|
|||
},
|
||||
isValid: false,
|
||||
},
|
||||
pubKeyTest{
|
||||
{
|
||||
name: "compressed claims uncompressed (ybit = 1)",
|
||||
key: []byte{0x05, 0x26, 0x89, 0xc7, 0xc2, 0xda, 0xb1, 0x33,
|
||||
0x09, 0xfb, 0x14, 0x3e, 0x0e, 0x8f, 0xe3, 0x96, 0x34,
|
||||
|
@ -159,12 +159,12 @@ var pubKeyTests = []pubKeyTest{
|
|||
},
|
||||
isValid: false,
|
||||
},
|
||||
pubKeyTest{
|
||||
{
|
||||
name: "wrong length)",
|
||||
key: []byte{0x05},
|
||||
isValid: false,
|
||||
},
|
||||
pubKeyTest{
|
||||
{
|
||||
name: "X == P",
|
||||
key: []byte{0x04, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
|
||||
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
|
||||
|
@ -177,7 +177,7 @@ var pubKeyTests = []pubKeyTest{
|
|||
},
|
||||
isValid: false,
|
||||
},
|
||||
pubKeyTest{
|
||||
{
|
||||
name: "X > P",
|
||||
key: []byte{0x04, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
|
||||
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
|
||||
|
@ -190,7 +190,7 @@ var pubKeyTests = []pubKeyTest{
|
|||
},
|
||||
isValid: false,
|
||||
},
|
||||
pubKeyTest{
|
||||
{
|
||||
name: "Y == P",
|
||||
key: []byte{0x04, 0x11, 0xdb, 0x93, 0xe1, 0xdc, 0xdb, 0x8a,
|
||||
0x01, 0x6b, 0x49, 0x84, 0x0f, 0x8c, 0x53, 0xbc, 0x1e,
|
||||
|
@ -203,7 +203,7 @@ var pubKeyTests = []pubKeyTest{
|
|||
},
|
||||
isValid: false,
|
||||
},
|
||||
pubKeyTest{
|
||||
{
|
||||
name: "Y > P",
|
||||
key: []byte{0x04, 0x11, 0xdb, 0x93, 0xe1, 0xdc, 0xdb, 0x8a,
|
||||
0x01, 0x6b, 0x49, 0x84, 0x0f, 0x8c, 0x53, 0xbc, 0x1e,
|
||||
|
|
|
@ -21,7 +21,7 @@ type signatureTest struct {
|
|||
var signatureTests = []signatureTest{
|
||||
// signatures from bitcoin blockchain tx
|
||||
// 0437cd7f8525ceed2324359c2d0ba26006d92d85
|
||||
signatureTest{
|
||||
{
|
||||
name: "valid signature.",
|
||||
sig: []byte{0x30, 0x44, 0x02, 0x20, 0x4e, 0x45, 0xe1, 0x69,
|
||||
0x32, 0xb8, 0xaf, 0x51, 0x49, 0x61, 0xa1, 0xd3, 0xa1,
|
||||
|
@ -35,12 +35,12 @@ var signatureTests = []signatureTest{
|
|||
der: true,
|
||||
isValid: true,
|
||||
},
|
||||
signatureTest{
|
||||
{
|
||||
name: "empty.",
|
||||
sig: []byte{},
|
||||
isValid: false,
|
||||
},
|
||||
signatureTest{
|
||||
{
|
||||
name: "bad magic.",
|
||||
sig: []byte{0x31, 0x44, 0x02, 0x20, 0x4e, 0x45, 0xe1, 0x69,
|
||||
0x32, 0xb8, 0xaf, 0x51, 0x49, 0x61, 0xa1, 0xd3, 0xa1,
|
||||
|
@ -54,7 +54,7 @@ var signatureTests = []signatureTest{
|
|||
der: true,
|
||||
isValid: false,
|
||||
},
|
||||
signatureTest{
|
||||
{
|
||||
name: "bad 1st int marker magic.",
|
||||
sig: []byte{0x30, 0x44, 0x03, 0x20, 0x4e, 0x45, 0xe1, 0x69,
|
||||
0x32, 0xb8, 0xaf, 0x51, 0x49, 0x61, 0xa1, 0xd3, 0xa1,
|
||||
|
@ -68,7 +68,7 @@ var signatureTests = []signatureTest{
|
|||
der: true,
|
||||
isValid: false,
|
||||
},
|
||||
signatureTest{
|
||||
{
|
||||
name: "bad 2nd int marker.",
|
||||
sig: []byte{0x30, 0x44, 0x02, 0x20, 0x4e, 0x45, 0xe1, 0x69,
|
||||
0x32, 0xb8, 0xaf, 0x51, 0x49, 0x61, 0xa1, 0xd3, 0xa1,
|
||||
|
@ -82,7 +82,7 @@ var signatureTests = []signatureTest{
|
|||
der: true,
|
||||
isValid: false,
|
||||
},
|
||||
signatureTest{
|
||||
{
|
||||
name: "short len",
|
||||
sig: []byte{0x30, 0x43, 0x02, 0x20, 0x4e, 0x45, 0xe1, 0x69,
|
||||
0x32, 0xb8, 0xaf, 0x51, 0x49, 0x61, 0xa1, 0xd3, 0xa1,
|
||||
|
@ -96,7 +96,7 @@ var signatureTests = []signatureTest{
|
|||
der: true,
|
||||
isValid: false,
|
||||
},
|
||||
signatureTest{
|
||||
{
|
||||
name: "long len",
|
||||
sig: []byte{0x30, 0x45, 0x02, 0x20, 0x4e, 0x45, 0xe1, 0x69,
|
||||
0x32, 0xb8, 0xaf, 0x51, 0x49, 0x61, 0xa1, 0xd3, 0xa1,
|
||||
|
@ -110,7 +110,7 @@ var signatureTests = []signatureTest{
|
|||
der: true,
|
||||
isValid: false,
|
||||
},
|
||||
signatureTest{
|
||||
{
|
||||
name: "long X",
|
||||
sig: []byte{0x30, 0x44, 0x02, 0x42, 0x4e, 0x45, 0xe1, 0x69,
|
||||
0x32, 0xb8, 0xaf, 0x51, 0x49, 0x61, 0xa1, 0xd3, 0xa1,
|
||||
|
@ -124,7 +124,7 @@ var signatureTests = []signatureTest{
|
|||
der: true,
|
||||
isValid: false,
|
||||
},
|
||||
signatureTest{
|
||||
{
|
||||
name: "long Y",
|
||||
sig: []byte{0x30, 0x44, 0x02, 0x20, 0x4e, 0x45, 0xe1, 0x69,
|
||||
0x32, 0xb8, 0xaf, 0x51, 0x49, 0x61, 0xa1, 0xd3, 0xa1,
|
||||
|
@ -138,7 +138,7 @@ var signatureTests = []signatureTest{
|
|||
der: true,
|
||||
isValid: false,
|
||||
},
|
||||
signatureTest{
|
||||
{
|
||||
name: "short Y",
|
||||
sig: []byte{0x30, 0x44, 0x02, 0x20, 0x4e, 0x45, 0xe1, 0x69,
|
||||
0x32, 0xb8, 0xaf, 0x51, 0x49, 0x61, 0xa1, 0xd3, 0xa1,
|
||||
|
@ -152,7 +152,7 @@ var signatureTests = []signatureTest{
|
|||
der: true,
|
||||
isValid: false,
|
||||
},
|
||||
signatureTest{
|
||||
{
|
||||
name: "trailing crap.",
|
||||
sig: []byte{0x30, 0x44, 0x02, 0x20, 0x4e, 0x45, 0xe1, 0x69,
|
||||
0x32, 0xb8, 0xaf, 0x51, 0x49, 0x61, 0xa1, 0xd3, 0xa1,
|
||||
|
@ -172,7 +172,7 @@ var signatureTests = []signatureTest{
|
|||
// signature.
|
||||
isValid: true,
|
||||
},
|
||||
signatureTest{
|
||||
{
|
||||
name: "X == N ",
|
||||
sig: []byte{0x30, 0x44, 0x02, 0x20, 0xFF, 0xFF, 0xFF, 0xFF,
|
||||
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
|
||||
|
@ -186,7 +186,7 @@ var signatureTests = []signatureTest{
|
|||
der: true,
|
||||
isValid: false,
|
||||
},
|
||||
signatureTest{
|
||||
{
|
||||
name: "X == N ",
|
||||
sig: []byte{0x30, 0x44, 0x02, 0x20, 0xFF, 0xFF, 0xFF, 0xFF,
|
||||
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
|
||||
|
@ -200,7 +200,7 @@ var signatureTests = []signatureTest{
|
|||
der: false,
|
||||
isValid: false,
|
||||
},
|
||||
signatureTest{
|
||||
{
|
||||
name: "Y == N",
|
||||
sig: []byte{0x30, 0x44, 0x02, 0x20, 0x4e, 0x45, 0xe1, 0x69,
|
||||
0x32, 0xb8, 0xaf, 0x51, 0x49, 0x61, 0xa1, 0xd3, 0xa1,
|
||||
|
@ -214,7 +214,7 @@ var signatureTests = []signatureTest{
|
|||
der: true,
|
||||
isValid: false,
|
||||
},
|
||||
signatureTest{
|
||||
{
|
||||
name: "Y > N",
|
||||
sig: []byte{0x30, 0x44, 0x02, 0x20, 0x4e, 0x45, 0xe1, 0x69,
|
||||
0x32, 0xb8, 0xaf, 0x51, 0x49, 0x61, 0xa1, 0xd3, 0xa1,
|
||||
|
@ -228,7 +228,7 @@ var signatureTests = []signatureTest{
|
|||
der: false,
|
||||
isValid: false,
|
||||
},
|
||||
signatureTest{
|
||||
{
|
||||
name: "0 len X.",
|
||||
sig: []byte{0x30, 0x24, 0x02, 0x00, 0x02, 0x20, 0x18, 0x15,
|
||||
0x22, 0xec, 0x8e, 0xca, 0x07, 0xde, 0x48, 0x60, 0xa4,
|
||||
|
@ -239,7 +239,7 @@ var signatureTests = []signatureTest{
|
|||
der: true,
|
||||
isValid: false,
|
||||
},
|
||||
signatureTest{
|
||||
{
|
||||
name: "0 len Y.",
|
||||
sig: []byte{0x30, 0x24, 0x02, 0x20, 0x4e, 0x45, 0xe1, 0x69,
|
||||
0x32, 0xb8, 0xaf, 0x51, 0x49, 0x61, 0xa1, 0xd3, 0xa1,
|
||||
|
@ -250,7 +250,7 @@ var signatureTests = []signatureTest{
|
|||
der: true,
|
||||
isValid: false,
|
||||
},
|
||||
signatureTest{
|
||||
{
|
||||
name: "extra R padding.",
|
||||
sig: []byte{0x30, 0x45, 0x02, 0x21, 0x00, 0x4e, 0x45, 0xe1, 0x69,
|
||||
0x32, 0xb8, 0xaf, 0x51, 0x49, 0x61, 0xa1, 0xd3, 0xa1,
|
||||
|
@ -264,7 +264,7 @@ var signatureTests = []signatureTest{
|
|||
der: true,
|
||||
isValid: false,
|
||||
},
|
||||
signatureTest{
|
||||
{
|
||||
name: "extra S padding.",
|
||||
sig: []byte{0x30, 0x45, 0x02, 0x20, 0x4e, 0x45, 0xe1, 0x69,
|
||||
0x32, 0xb8, 0xaf, 0x51, 0x49, 0x61, 0xa1, 0xd3, 0xa1,
|
||||
|
@ -286,7 +286,7 @@ var signatureTests = []signatureTest{
|
|||
// at all. When not parsing DER signatures, which is done by by bitcoind
|
||||
// when accepting transactions into its mempool, we otherwise only check
|
||||
// for the coordinates being zero.
|
||||
signatureTest{
|
||||
{
|
||||
name: "X == 0",
|
||||
sig: []byte{0x30, 0x25, 0x02, 0x01, 0x00, 0x02, 0x20, 0x18,
|
||||
0x15, 0x22, 0xec, 0x8e, 0xca, 0x07, 0xde, 0x48, 0x60,
|
||||
|
@ -297,7 +297,7 @@ var signatureTests = []signatureTest{
|
|||
der: false,
|
||||
isValid: false,
|
||||
},
|
||||
signatureTest{
|
||||
{
|
||||
name: "Y == 0.",
|
||||
sig: []byte{0x30, 0x25, 0x02, 0x20, 0x4e, 0x45, 0xe1, 0x69,
|
||||
0x32, 0xb8, 0xaf, 0x51, 0x49, 0x61, 0xa1, 0xd3, 0xa1,
|
||||
|
|
Loading…
Reference in a new issue