mirror of
https://github.com/bitcoin/bips.git
synced 2026-11-16 19:48:35 +00:00
bip-0327: add test vectors for a public key and its negation
A public key and its negation have the same X coordinate, and their compressed encodings differ only in the first byte. Add a Sign test vector with a secnonce generated for the negation of the signer's public key, and a KeyAgg test vector with a public key and its negation. They detect implementations that compare public keys only by their X coordinates, in the public key check of Sign, in GetSecondKey, or in KeyAggCoeffInternal. Distinct public keys in the previous test vectors also have distinct X coordinates. The public key check in Sign ensures that the secret key provided to Sign is determined when NonceGen is invoked. Comparing only X coordinates determines the secret key only up to negation.
This commit is contained in:
1 parent
0ba8e56a02
commit
17affe2861
2 files changed
+20
-2
No files matched your search
@@ -6,7 +6,8 @@
|
||||
"020000000000000000000000000000000000000000000000000000000000000005",
|
||||
"02FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFC30",
|
||||
"04F9308A019258C31049344F85F89D5229B531C845836F99B08601F113BCE036F9",
|
||||
"03935F972DA013F80AE011890FA89B67A27B7BE6CCB24D3274D18B2D4067F261A9"
|
||||
"03935F972DA013F80AE011890FA89B67A27B7BE6CCB24D3274D18B2D4067F261A9",
|
||||
"03F9308A019258C31049344F85F89D5229B531C845836F99B08601F113BCE036F9"
|
||||
],
|
||||
"tweaks": [
|
||||
"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141",
|
||||
@@ -28,6 +29,11 @@
|
||||
{
|
||||
"key_indices": [0, 0, 1, 1],
|
||||
"expected": "69BC22BFA5D106306E48A20679DE1D7389386124D07571D0D872686028C26A3E"
|
||||
},
|
||||
{
|
||||
"key_indices": [0, 7],
|
||||
"expected": "A886A992E178FB725FA308586018634D0936AE8CC27299675D90947FFCE0B4A6",
|
||||
"comment": "The second public key is the negation of the first. Detects implementations that compare public keys only by X coordinate in GetSecondKey or KeyAggCoeffInternal."
|
||||
}
|
||||
],
|
||||
"error_test_cases": [
|
||||
|
||||
@@ -12,7 +12,8 @@
|
||||
"508B81A611F100A6B2B6B29656590898AF488BCF2E1F55CF22E5CFB84421FE61000000000000000000000000000000000000000000000000000000000000000003935F972DA013F80AE011890FA89B67A27B7BE6CCB24D3274D18B2D4067F261A9",
|
||||
"508B81A611F100A6B2B6B29656590898AF488BCF2E1F55CF22E5CFB84421FE61FA27FD49B1D50085B481285E1CA205D55C82CC1B31FF5CD54A489829355901F702F9308A019258C31049344F85F89D5229B531C845836F99B08601F113BCE036F9",
|
||||
"508B81A611F100A6B2B6B29656590898AF488BCF2E1F55CF22E5CFB84421FE61FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD036414103935F972DA013F80AE011890FA89B67A27B7BE6CCB24D3274D18B2D4067F261A9",
|
||||
"508B81A611F100A6B2B6B29656590898AF488BCF2E1F55CF22E5CFB84421FE61FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD036414203935F972DA013F80AE011890FA89B67A27B7BE6CCB24D3274D18B2D4067F261A9"
|
||||
"508B81A611F100A6B2B6B29656590898AF488BCF2E1F55CF22E5CFB84421FE61FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD036414203935F972DA013F80AE011890FA89B67A27B7BE6CCB24D3274D18B2D4067F261A9",
|
||||
"508B81A611F100A6B2B6B29656590898AF488BCF2E1F55CF22E5CFB84421FE61FA27FD49B1D50085B481285E1CA205D55C82CC1B31FF5CD54A489829355901F702935F972DA013F80AE011890FA89B67A27B7BE6CCB24D3274D18B2D4067F261A9"
|
||||
],
|
||||
"pnonces": [
|
||||
"0337C87821AFD50A8644D820A8F3E02E499C931865C2360FB43D0A0D20DAFE07EA0287BF891D2A6DEAEBADC909352AA9405D1428C15F4B75F04DAE642A95C2548480",
|
||||
@@ -211,6 +212,17 @@
|
||||
"message": "second secnonce value is out of range."
|
||||
},
|
||||
"comment": "Secnonce is invalid because its second half exceeds group size. Detects implementations that reduce k2' mod n and then check only that it is nonzero."
|
||||
},
|
||||
{
|
||||
"key_indices": [0, 1, 2],
|
||||
"aggnonce_index": 0,
|
||||
"msg_index": 0,
|
||||
"secnonce_index": 6,
|
||||
"error": {
|
||||
"type": "value",
|
||||
"message": "Public key does not match nonce_gen argument"
|
||||
},
|
||||
"comment": "Secnonce was generated for the negation of the signer's public key. Detects implementations that compare secnonce[64:97] with the signer's public key only by X coordinate."
|
||||
}
|
||||
],
|
||||
"verify_fail_test_cases": [
|
||||
|
||||
Reference in new issue
Block a user