diff --git a/bip-0327.mediawiki b/bip-0327.mediawiki
index 117d6c7b..9e80b2e2 100644
--- a/bip-0327.mediawiki
+++ b/bip-0327.mediawiki
@@ -10,7 +10,7 @@
License: BSD-3-Clause
Discussion: 2022-04-05: https://lists.linuxfoundation.org/pipermail/bitcoin-dev/2022-April/020198.html [bitcoin-dev] MuSig2 BIP
2022-10-11: https://lists.linuxfoundation.org/pipermail/bitcoin-dev/2022-October/021000.html [bitcoin-dev] MuSig2 BIP
- Version: 1.0.4
+ Version: 1.0.5
== Introduction ==
@@ -782,6 +782,8 @@ An exception to this rule is MAJOR version zero (0.y.z) which is fo
The MINOR version is incremented whenever the inputs or the output of an algorithm changes in a backward-compatible way or new backward-compatible functionality is added.
The PATCH version is incremented for other changes that are noteworthy (bug fixes, test vectors, important clarifications, etc.).
+* '''1.0.5''' (2026-11-10):
+** Add test vectors that detect implementation mistakes the previous test vectors missed, and improve a ''PartialSigVerify'' test vector.
* '''1.0.4''' (2026-08-19):
** Fix two minor bugs in the specification of ''PartialSigAgg''.
* '''1.0.3''' (2026-01-05):
@@ -831,4 +833,4 @@ The PATCH version is incremented for other changes that are notewor
== Acknowledgements ==
-We thank Brandon Black, Riccardo Casatta, Sivaram Dhakshinamoorthy, Lloyd Fournier, Russell O'Connor, and Pieter Wuille for their contributions to this document.
+We thank Ferdinando Ametrano, Brandon Black, Riccardo Casatta, Sivaram Dhakshinamoorthy, Lloyd Fournier, Russell O'Connor, and Pieter Wuille for their contributions to this document.
diff --git a/bip-0327/gen_vectors_helper.py b/bip-0327/gen_vectors_helper.py
index 03c2dbb2..8b254466 100644
--- a/bip-0327/gen_vectors_helper.py
+++ b/bip-0327/gen_vectors_helper.py
@@ -15,6 +15,38 @@ def gen_key_agg_vectors():
print(" pubkey:", pk.hex().upper())
print(" tweak: ", tweak.hex().upper())
+def gen_sign_verify_vectors():
+ print("sign_verify_vectors.json: Signature exceeds group size but is valid modulo n")
+ with open(os.path.join(sys.path[0], 'vectors', 'sign_verify_vectors.json')) as f:
+ test_data = json.load(f)
+ X = fromhex_all(test_data["pubkeys"])
+ pnonce = fromhex_all(test_data["pnonces"])
+ aggnonce = bytes.fromhex(test_data["aggnonces"][0])
+ msg = bytes.fromhex(test_data["msgs"][0])
+ pubkeys = X[0:3]
+
+ session_ctx = SessionContext(aggnonce, pubkeys, [], [], msg)
+ (Q, gacc, _, b, R, e) = get_session_values(session_ctx)
+ P = cpoint(pubkeys[0])
+ a = get_session_key_agg_coeff(session_ctx, P)
+ g = 1 if has_even_y(Q) else n - 1
+ # Choose the first half of the pubnonce of signer 0 such that the effective
+ # nonce of signer 0 is -e*a*g*gacc*P. Then the partial signature 0 is
+ # valid. Since n*G = 0*G, the partial signature n satisfies the
+ # verification equation as well, so only the range check rejects it.
+ T = point_mul(P, e * a * g * gacc % n)
+ Re_s_ = point_negate(T) if has_even_y(R) else T
+ R_s2 = cpoint(pnonce[0][33:66])
+ R_s1 = point_add(Re_s_, point_negate(point_mul(R_s2, b)))
+ # Change the first half of the pubnonce of signer 2 such that the
+ # aggregate nonce, and thus b, R and e, stay the same.
+ R_s1_2 = point_add(cpoint(aggnonce[0:33]), point_negate(point_add(R_s1, cpoint(pnonce[1][0:33]))))
+ pubnonces = [cbytes(R_s1) + pnonce[0][33:66], pnonce[1], cbytes(R_s1_2) + pnonce[2][33:66]]
+ assert nonce_agg(pubnonces) == aggnonce
+ assert partial_sig_verify(bytes_from_int(0), pubnonces, pubkeys, [], [], msg, 0)
+ print(" pnonce of signer 0:", pubnonces[0].hex().upper())
+ print(" pnonce of signer 2:", pubnonces[2].hex().upper())
+
def check_sign_verify_vectors():
with open(os.path.join(sys.path[0], 'vectors', 'sign_verify_vectors.json')) as f:
test_data = json.load(f)
@@ -80,7 +112,7 @@ def sig_agg_vectors():
"75448A87274B056468B977BE06EB1E9F657577B7320B0A3376EA51FD420D18A8"])
msg = bytes.fromhex("599C67EA410D005B9DA90817CF03ED3B1C868E4DA4EDF00A5880B0082C237869")
- psigs = [None] * 9
+ psigs = [None] * 12
valid_test_cases = [
{
@@ -111,6 +143,22 @@ def sig_agg_vectors():
"tweak_indices": [0, 1, 2],
"is_xonly": [True, False, True],
"psig_indices": [6, 7],
+ }, {
+ "aggnonce": None,
+ "nonce_indices": [0],
+ "key_indices": [0],
+ "tweak_indices": [],
+ "is_xonly": [],
+ "psig_indices": [9],
+ "comment": "A single signer. Detects implementations that reject a single signer in PartialSigAgg.",
+ }, {
+ "aggnonce": None,
+ "nonce_indices": [0, 5],
+ "key_indices": [0, 1],
+ "tweak_indices": [2],
+ "is_xonly": [False],
+ "psig_indices": [10, 11],
+ "comment": "The tweaked aggregate public key has an odd Y coordinate. Detects implementations that omit g in e*g*tacc.",
},
]
for (i, test_case) in enumerate(valid_test_cases):
@@ -135,11 +183,14 @@ def sig_agg_vectors():
sig = partial_sig_agg([psigs[i] for i in psig_indices], session_ctx)
keygen_ctx = key_agg_and_tweak(vec_pubkeys, vec_tweaks, is_xonly)
# To maximize coverage of the sig_agg algorithm, we want one public key
- # point with an even and one with an odd Y coordinate.
+ # point with an even and one with an odd Y coordinate, and one tweaked
+ # public key point with an odd Y coordinate.
if i == 0:
assert(has_even_y(keygen_ctx[0]))
if i == 1:
assert(not has_even_y(keygen_ctx[0]))
+ if i == 5:
+ assert(not has_even_y(keygen_ctx[0]) and keygen_ctx[2] != 0)
aggpk = get_xonly_pk(keygen_ctx)
assert schnorr_verify(msg, aggpk, sig)
test_case["expected"] = sig.hex().upper()
@@ -179,6 +230,7 @@ def sig_agg_vectors():
}, indent=4))
gen_key_agg_vectors()
+gen_sign_verify_vectors()
check_sign_verify_vectors()
check_tweak_vectors()
print()
diff --git a/bip-0327/vectors/README.md b/bip-0327/vectors/README.md
new file mode 100644
index 00000000..d58d3da6
--- /dev/null
+++ b/bip-0327/vectors/README.md
@@ -0,0 +1,8 @@
+# BIP327 test vectors
+
+BIP327 specifies the length and number of the inputs of each algorithm, for example that each tweak is a 32-byte array and that there is one tweak mode for each tweak.
+The test vectors only contain inputs that meet these specifications.
+Since BIP327 does not specify how algorithms handle other inputs, such as a 31-byte tweak or a missing tweak mode, the test vectors do not test them.
+
+A test vector should only be added if it detects a plausible implementation mistake that the other test vectors do not detect.
+The comment of the test vector names the mistake, for example "Detects implementations that set gacc to g instead of multiplying it by g".
diff --git a/bip-0327/vectors/det_sign_vectors.json b/bip-0327/vectors/det_sign_vectors.json
index 261669cc..c0f0fc48 100644
--- a/bip-0327/vectors/det_sign_vectors.json
+++ b/bip-0327/vectors/det_sign_vectors.json
@@ -8,7 +8,8 @@
],
"msgs": [
"F95466D086770E689964664219266FE5ED215C92AE20BAB5C9D79ADDDDF3C0CF",
- "2626262626262626262626262626262626262626262626262626262626262626262626262626"
+ "2626262626262626262626262626262626262626262626262626262626262626262626262626",
+ "000102030405060708090A0B0C0D0E0F101112131415161718191A1B1C1D1E1F202122232425262728292A2B2C2D2E2F303132333435363738393A3B3C3D3E3F404142434445464748494A4B4C4D4E4F505152535455565758595A5B5C5D5E5F606162636465666768696A6B6C6D6E6F707172737475767778797A7B7C7D7E7F808182838485868788898A8B8C8D8E8F909192939495969798999A9B9C9D9E9FA0A1A2A3A4A5A6A7A8A9AAABACADAEAFB0B1B2B3B4B5B6B7B8B9BABBBCBDBEBFC0C1C2C3C4C5C6C7C8C9CACBCCCDCECFD0D1D2D3D4D5D6D7D8D9DADBDCDDDEDFE0E1E2E3E4E5E6E7E8E9EAEBECEDEEEFF0F1F2F3F4F5F6F7F8F9FAFBFCFDFEFF"
],
"valid_test_cases": [
{
@@ -64,6 +65,34 @@
"7B1246C5889E59CB0375FA395CC86AC42D5D7D59FD8EAB4FDF1DCAB2B2F006EA"
],
"comment": "Tweaked public key"
+ },
+ {
+ "rand": "0000000000000000000000000000000000000000000000000000000000000000",
+ "aggothernonce": "032DE2662628C90B03F5E720284EB52FF7D71F4284F627B68A853D78C78E1FFE9303E4C5524E83FFE1493B9077CF1CA6BEB2090C93D930321071AD40B2F44E599046",
+ "key_indices": [0, 1, 2],
+ "tweaks": ["E8F791FF9225A2AF0102AFFF4A9A723D9612A682A25EBE79802B263CDFCD83BB", "AE2EA797CC0FE72AC5B97B97F3C6957D7E4199A167A58EB08BCAFFDA70AC0455"],
+ "is_xonly": [false, true],
+ "msg_index": 0,
+ "signer_index": 0,
+ "expected": [
+ "0216794FAEAAED862634A73DBCE667395FE479CF0986B0111451F6C0EF8B82C04702BE7347E8CFF7540585ACC13D3B727372263E65A0E034D90CC3B2DF22603EF972",
+ "324600EDB5B0321F47C27D7843EA38A4B61A80C276AB3EA5E9435B254D135B6B"
+ ],
+ "comment": "Plain and x-only tweaks. Detects implementations that treat every tweak as x-only."
+ },
+ {
+ "rand": "0000000000000000000000000000000000000000000000000000000000000000",
+ "aggothernonce": "0337C87821AFD50A8644D820A8F3E02E499C931865C2360FB43D0A0D20DAFE07EA0287BF891D2A6DEAEBADC909352AA9405D1428C15F4B75F04DAE642A95C2548480",
+ "key_indices": [0, 1, 2],
+ "tweaks": [],
+ "is_xonly": [],
+ "msg_index": 2,
+ "signer_index": 0,
+ "expected": [
+ "02CB9B7D4A7EC68635468B52755DD0314879F0E9EAE728817559B6DD213C4B4210024CDABB29C9BC46921F57FC622BA72A7E1AC431B4286DBB23927FFD2ECFF63A51",
+ "D6CCC452B5C1277001A9178467AD697ECAB99E383B1C6F592A1C07F3723E541A"
+ ],
+ "comment": "Message of 256 bytes. Detects implementations that encode only the low byte of the message length."
}
],
"error_test_cases": [
diff --git a/bip-0327/vectors/key_agg_vectors.json b/bip-0327/vectors/key_agg_vectors.json
index b2e623de..45d12e94 100644
--- a/bip-0327/vectors/key_agg_vectors.json
+++ b/bip-0327/vectors/key_agg_vectors.json
@@ -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": [
diff --git a/bip-0327/vectors/nonce_gen_vectors.json b/bip-0327/vectors/nonce_gen_vectors.json
index ced946f3..3fe19f12 100644
--- a/bip-0327/vectors/nonce_gen_vectors.json
+++ b/bip-0327/vectors/nonce_gen_vectors.json
@@ -39,6 +39,39 @@
"extra_in": null,
"expected_secnonce": "89BDD787D0284E5E4D5FC572E49E316BAB7E21E3B1830DE37DFE80156FA41A6D0B17AE8D024C53679699A6FD7944D9C4A366B514BAF43088E0708B1023DD289702F9308A019258C31049344F85F89D5229B531C845836F99B08601F113BCE036F9",
"expected_pubnonce": "02C96E7CB1E8AA5DAC64D872947914198F607D90ECDE5200DE52978AD5DED63C000299EC5117C2D29EDEE8A2092587C3909BE694D5CFF0667D6C02EA4059F7CD9786"
+ },
+ {
+ "rand_": "0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F",
+ "sk": "0202020202020202020202020202020202020202020202020202020202020202",
+ "pk": "024D4B6CD1361032CA9BD2AEB9D900AA4D45D9EAD80AC9423374C451A7254D0766",
+ "aggpk": "0707070707070707070707070707070707070707070707070707070707070707",
+ "msg": "0101010101010101010101010101010101010101010101010101010101010101",
+ "extra_in": "08080808",
+ "expected_secnonce": "8BEDC2ABC2D7F00976C8A932314683C9A9BE9B8A71A7C2F3F54B9C303215AE7C13C471707BA3CDC623D7B4F9B6BF3AFD140B9A3C936F6FE05FF22F344387D853024D4B6CD1361032CA9BD2AEB9D900AA4D45D9EAD80AC9423374C451A7254D0766",
+ "expected_pubnonce": "0357C9EEBFFA55BF667E0AACF5412C1E9EBDEBEFFC764F9FCBEA748BBFD275C4400303C378032670DCBC1D9ACDF8EC113FE863A249FC74D3E88F898C1B2540A7CC00",
+ "comment": "extra_in shorter than 32 bytes. Detects implementations that encode the length of extra_in as 32 whenever extra_in is present. This test case is optional: it can be skipped by implementations that only support a 32-byte extra_in."
+ },
+ {
+ "rand_": "0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F",
+ "sk": "0202020202020202020202020202020202020202020202020202020202020202",
+ "pk": "024D4B6CD1361032CA9BD2AEB9D900AA4D45D9EAD80AC9423374C451A7254D0766",
+ "aggpk": "0707070707070707070707070707070707070707070707070707070707070707",
+ "msg": "000102030405060708090A0B0C0D0E0F101112131415161718191A1B1C1D1E1F202122232425262728292A2B2C2D2E2F303132333435363738393A3B3C3D3E3F404142434445464748494A4B4C4D4E4F505152535455565758595A5B5C5D5E5F606162636465666768696A6B6C6D6E6F707172737475767778797A7B7C7D7E7F808182838485868788898A8B8C8D8E8F909192939495969798999A9B9C9D9E9FA0A1A2A3A4A5A6A7A8A9AAABACADAEAFB0B1B2B3B4B5B6B7B8B9BABBBCBDBEBFC0C1C2C3C4C5C6C7C8C9CACBCCCDCECFD0D1D2D3D4D5D6D7D8D9DADBDCDDDEDFE0E1E2E3E4E5E6E7E8E9EAEBECEDEEEFF0F1F2F3F4F5F6F7F8F9FAFBFCFDFEFF",
+ "extra_in": "0808080808080808080808080808080808080808080808080808080808080808",
+ "expected_secnonce": "A7DA22BD150F412D85E5DB863DE9E3DB3BD1185AC3EFBB2C187EB6385140DC9F979ABE5529FDA821A31081A521687C6D95C940F34FD7F088129A4599025E960D024D4B6CD1361032CA9BD2AEB9D900AA4D45D9EAD80AC9423374C451A7254D0766",
+ "expected_pubnonce": "029AE00806C1C5D4650A86BD252B71360BCB46CB8F55E25F1D1963EF2E63BA10CF0394C3255F45ED9271C49ECE4B92F6863344E169206FFC2158036AB102BED040E8",
+ "comment": "Message of 256 bytes. Detects implementations that encode only the low byte of the message length."
+ },
+ {
+ "rand_": "000102030405060708090A0B0C0D0E0F101112131415161718191A1B1C1D1E1F",
+ "sk": "7FB9E0E687ADA1EEBF7ECFE2F21E73EBDB51A7D450948DFE8D76D7F2D1007671",
+ "pk": "03935F972DA013F80AE011890FA89B67A27B7BE6CCB24D3274D18B2D4067F261A9",
+ "aggpk": "0707070707070707070707070707070707070707070707070707070707070707",
+ "msg": "0101010101010101010101010101010101010101010101010101010101010101",
+ "extra_in": "0808080808080808080808080808080808080808080808080808080808080808",
+ "expected_secnonce": "E739C0DDB9673209EE2E80C0DFEEAA7C230B8672BA1D2D5AD8460FFBAEA35B2A4435BF6BA90D5714EDBBCC04129FA89E1F6F2606B13A356E1C71EC8E8325617203935F972DA013F80AE011890FA89B67A27B7BE6CCB24D3274D18B2D4067F261A9",
+ "expected_pubnonce": "039ACD0A88C7785D3D4E88FC16EFA696B07C590C98D8C052934EBE8F8DF9E92DC00222A70E75E42CFBC98B4C32AF73B1753C0642C9A0A6EA962DBBC77C4B5F813A38",
+ "comment": "rand_ and sk are not a repeated byte, and pk has an odd Y coordinate. Detects implementations that reverse rand_ or sk, use only the first byte of rand_, or replace the first byte of pk with 02."
}
]
}
diff --git a/bip-0327/vectors/sig_agg_vectors.json b/bip-0327/vectors/sig_agg_vectors.json
index 519562c3..08808fe8 100644
--- a/bip-0327/vectors/sig_agg_vectors.json
+++ b/bip-0327/vectors/sig_agg_vectors.json
@@ -27,7 +27,10 @@
"DDEF427BBB847CC027BEFF4EDB01038148917832253EBC355FC33F4A8E2FCCE4",
"97B890A26C981DA8102D3BC294159D171D72810FDF7C6A691DEF02F0F7AF3FDC",
"53FA9E08BA5243CBCB0D797C5EE83BC6728E539EB76C2D0BF0F971EE4E909971",
- "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141"
+ "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141",
+ "03E2479CF7C582CB216D2411DFEAA169037639E77FA0A7440DF5BCC2359E072D",
+ "32D55C70B8AD7CA5C6C04271B1AC8FDB8AE08C926DDE6A5DD3876CFE5BFFA312",
+ "9F8D1B300A571F9958B84412B0D01B3DE4D5ED5D9DEF63357C707AF1A49E6B3A"
],
"msg": "599C67EA410D005B9DA90817CF03ED3B1C868E4DA4EDF00A5880B0082C237869",
"valid_test_cases": [
@@ -114,6 +117,45 @@
7
],
"expected": "839B08820B681DBA8DAF4CC7B104E8F2638F9388F8D7A555DC17B6E6971D7426CE07BF6AB01F1DB50E4E33719295F4094572B79868E440FB3DEFD3FAC1DB589E"
+ },
+ {
+ "aggnonce": "036E5EE6E28824029FEA3E8A9DDD2C8483F5AF98F7177C3AF3CB6F47CAF8D94AE902DBA67E4A1F3680826172DA15AFB1A8CA85C7C5CC88900905C8DC8C328511B53E",
+ "nonce_indices": [
+ 0
+ ],
+ "key_indices": [
+ 0
+ ],
+ "tweak_indices": [],
+ "is_xonly": [],
+ "psig_indices": [
+ 9
+ ],
+ "comment": "A single signer. Detects implementations that reject a single signer in PartialSigAgg.",
+ "expected": "0EAAB454E75DF2C5B4B7AA07126D4525171B6331A5E6A074C75924738709A1B603E2479CF7C582CB216D2411DFEAA169037639E77FA0A7440DF5BCC2359E072D"
+ },
+ {
+ "aggnonce": "0312046E1C8A4DAC758DB7C86A31480439EA3125696BD035A4F2E3AED426E04C5E02A6A5697B14CC0D44A71DEC4FBA75B8B40CED9C71E090D2EADDD661BC90630306",
+ "nonce_indices": [
+ 0,
+ 5
+ ],
+ "key_indices": [
+ 0,
+ 1
+ ],
+ "tweak_indices": [
+ 2
+ ],
+ "is_xonly": [
+ false
+ ],
+ "psig_indices": [
+ 10,
+ 11
+ ],
+ "comment": "The tweaked aggregate public key has an odd Y coordinate. Detects implementations that omit g in e*g*tacc.",
+ "expected": "AC72289943B24BF57EAC882DE6490D39B69B894F27E94E8B54E7A3971EFCD358ED75884545D1AAE735F101578FCC1DB195B478FC2A9E1BA7EF4D9D119D4F7428"
}
],
"error_test_cases": [
diff --git a/bip-0327/vectors/sign_verify_vectors.json b/bip-0327/vectors/sign_verify_vectors.json
index f71c8dd9..66b6402e 100644
--- a/bip-0327/vectors/sign_verify_vectors.json
+++ b/bip-0327/vectors/sign_verify_vectors.json
@@ -8,21 +8,29 @@
],
"secnonces": [
"508B81A611F100A6B2B6B29656590898AF488BCF2E1F55CF22E5CFB84421FE61FA27FD49B1D50085B481285E1CA205D55C82CC1B31FF5CD54A489829355901F703935F972DA013F80AE011890FA89B67A27B7BE6CCB24D3274D18B2D4067F261A9",
- "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003935F972DA013F80AE011890FA89B67A27B7BE6CCB24D3274D18B2D4067F261A9"
+ "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003935F972DA013F80AE011890FA89B67A27B7BE6CCB24D3274D18B2D4067F261A9",
+ "508B81A611F100A6B2B6B29656590898AF488BCF2E1F55CF22E5CFB84421FE61000000000000000000000000000000000000000000000000000000000000000003935F972DA013F80AE011890FA89B67A27B7BE6CCB24D3274D18B2D4067F261A9",
+ "508B81A611F100A6B2B6B29656590898AF488BCF2E1F55CF22E5CFB84421FE61FA27FD49B1D50085B481285E1CA205D55C82CC1B31FF5CD54A489829355901F702F9308A019258C31049344F85F89D5229B531C845836F99B08601F113BCE036F9",
+ "508B81A611F100A6B2B6B29656590898AF488BCF2E1F55CF22E5CFB84421FE61FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD036414103935F972DA013F80AE011890FA89B67A27B7BE6CCB24D3274D18B2D4067F261A9",
+ "508B81A611F100A6B2B6B29656590898AF488BCF2E1F55CF22E5CFB84421FE61FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD036414203935F972DA013F80AE011890FA89B67A27B7BE6CCB24D3274D18B2D4067F261A9",
+ "508B81A611F100A6B2B6B29656590898AF488BCF2E1F55CF22E5CFB84421FE61FA27FD49B1D50085B481285E1CA205D55C82CC1B31FF5CD54A489829355901F702935F972DA013F80AE011890FA89B67A27B7BE6CCB24D3274D18B2D4067F261A9"
],
"pnonces": [
"0337C87821AFD50A8644D820A8F3E02E499C931865C2360FB43D0A0D20DAFE07EA0287BF891D2A6DEAEBADC909352AA9405D1428C15F4B75F04DAE642A95C2548480",
"0279BE667EF9DCBBAC55A06295CE870B07029BFCDB2DCE28D959F2815B16F817980279BE667EF9DCBBAC55A06295CE870B07029BFCDB2DCE28D959F2815B16F81798",
"032DE2662628C90B03F5E720284EB52FF7D71F4284F627B68A853D78C78E1FFE9303E4C5524E83FFE1493B9077CF1CA6BEB2090C93D930321071AD40B2F44E599046",
"0237C87821AFD50A8644D820A8F3E02E499C931865C2360FB43D0A0D20DAFE07EA0387BF891D2A6DEAEBADC909352AA9405D1428C15F4B75F04DAE642A95C2548480",
- "0200000000000000000000000000000000000000000000000000000000000000090287BF891D2A6DEAEBADC909352AA9405D1428C15F4B75F04DAE642A95C2548480"
+ "0200000000000000000000000000000000000000000000000000000000000000090287BF891D2A6DEAEBADC909352AA9405D1428C15F4B75F04DAE642A95C2548480",
+ "0394D770EB9681D29BDCF7B4CD6A7B25CF5E1688BBA5E8601C9A84B40BF7BFBBB90287BF891D2A6DEAEBADC909352AA9405D1428C15F4B75F04DAE642A95C2548480",
+ "034EB831A6C253C123F87AF3B9C56757306A0FAD45816D0A58406BB16CA16A56CC03E4C5524E83FFE1493B9077CF1CA6BEB2090C93D930321071AD40B2F44E599046"
],
"aggnonces": [
"028465FCF0BBDBCF443AABCCE533D42B4B5A10966AC09A49655E8C42DAAB8FCD61037496A3CC86926D452CAFCFD55D25972CA1675D549310DE296BFF42F72EEEA8C9",
"000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"048465FCF0BBDBCF443AABCCE533D42B4B5A10966AC09A49655E8C42DAAB8FCD61037496A3CC86926D452CAFCFD55D25972CA1675D549310DE296BFF42F72EEEA8C9",
"028465FCF0BBDBCF443AABCCE533D42B4B5A10966AC09A49655E8C42DAAB8FCD61020000000000000000000000000000000000000000000000000000000000000009",
- "028465FCF0BBDBCF443AABCCE533D42B4B5A10966AC09A49655E8C42DAAB8FCD6102FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFC30"
+ "028465FCF0BBDBCF443AABCCE533D42B4B5A10966AC09A49655E8C42DAAB8FCD6102FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFC30",
+ "0337C87821AFD50A8644D820A8F3E02E499C931865C2360FB43D0A0D20DAFE07EA0287BF891D2A6DEAEBADC909352AA9405D1428C15F4B75F04DAE642A95C2548480"
],
"msgs": [
"F95466D086770E689964664219266FE5ED215C92AE20BAB5C9D79ADDDDF3C0CF",
@@ -80,6 +88,15 @@
"signer_index": 0,
"expected": "E184351828DA5094A97C79CABDAAA0BFB87608C32E8829A4DF5340A6F243B78C",
"comment": "38-byte message"
+ },
+ {
+ "key_indices": [0],
+ "nonce_indices": [0],
+ "aggnonce_index": 5,
+ "msg_index": 0,
+ "signer_index": 0,
+ "expected": "22D1B07E5D00C726B7E1362C87166935722EE66E7D8312182085D3010D71A536",
+ "comment": "A single signer. Detects implementations that reject a single signer in Sign or PartialSigVerify."
}
],
"sign_error_test_cases": [
@@ -153,6 +170,61 @@
"message": "first secnonce value is out of range."
},
"comment": "Secnonce is invalid which may indicate nonce reuse"
+ },
+ {
+ "key_indices": [0, 1, 2],
+ "aggnonce_index": 0,
+ "msg_index": 0,
+ "secnonce_index": 2,
+ "error": {
+ "type": "value",
+ "message": "second secnonce value is out of range."
+ },
+ "comment": "Secnonce is invalid because its second half is zero. Detects implementations that check only that k2' < n and omit the optional verification at the end of Sign."
+ },
+ {
+ "key_indices": [0, 1, 2],
+ "aggnonce_index": 0,
+ "msg_index": 0,
+ "secnonce_index": 3,
+ "error": {
+ "type": "value",
+ "message": "Public key does not match nonce_gen argument"
+ },
+ "comment": "Secnonce was generated for another signer's public key. Detects implementations that check only that secnonce[64:97] is one of the public keys."
+ },
+ {
+ "key_indices": [0, 1, 2],
+ "aggnonce_index": 0,
+ "msg_index": 0,
+ "secnonce_index": 4,
+ "error": {
+ "type": "value",
+ "message": "second secnonce value is out of range."
+ },
+ "comment": "Secnonce is invalid because its second half equals group size. Detects implementations that check k2' <= n instead of k2' < n and omit the optional verification at the end of Sign."
+ },
+ {
+ "key_indices": [0, 1, 2],
+ "aggnonce_index": 0,
+ "msg_index": 0,
+ "secnonce_index": 5,
+ "error": {
+ "type": "value",
+ "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": [
@@ -175,10 +247,10 @@
{
"sig": "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141",
"key_indices": [0, 1, 2],
- "nonce_indices": [0, 1, 2],
+ "nonce_indices": [5, 1, 6],
"msg_index": 0,
"signer_index": 0,
- "comment": "Signature exceeds group size"
+ "comment": "Signature exceeds group size but is valid modulo n. Detects implementations that omit the range check of the partial signature or check s <= n instead of s < n."
}
],
"verify_error_test_cases": [
diff --git a/bip-0327/vectors/tweak_vectors.json b/bip-0327/vectors/tweak_vectors.json
index d0a7cfe8..ed62b245 100644
--- a/bip-0327/vectors/tweak_vectors.json
+++ b/bip-0327/vectors/tweak_vectors.json
@@ -65,6 +65,15 @@
"signer_index": 2,
"expected": "B255FDCAC27B40C7CE7848E2D3B7BF5EA0ED756DA81565AC804CCCA3E1D5D239",
"comment": "Four tweaks: x-only, plain, x-only, plain. If an implementation prohibits applying plain tweaks after x-only tweaks, it can skip this test vector or return an error."
+ },
+ {
+ "key_indices": [1, 2, 0],
+ "nonce_indices": [1, 2, 0],
+ "tweak_indices": [1, 2],
+ "is_xonly": [true, true],
+ "signer_index": 2,
+ "expected": "25414E2E06EAF13CB3FA6BB84A5E65C0A576D7230A6D2193A481B4EEC51AE5FD",
+ "comment": "Two x-only tweaks, of which only the first negates the aggregate public key. Detects implementations that set gacc to g instead of multiplying it by g."
}
],
"error_test_cases": [