@@ -122,7 +122,7 @@ def schnorr_sign(msg, seckey, aux_rand):
122
122
sig = bytes_from_point (R ) + bytes_from_int ((k + e * d ) % n )
123
123
debug_print_vars ()
124
124
if not schnorr_verify (msg , bytes_from_point (P ), sig ):
125
- raise RuntimeError ('The signature does not pass verification.' )
125
+ raise RuntimeError ('The created signature does not pass verification.' )
126
126
return sig
127
127
128
128
def schnorr_verify (msg , pubkey , sig ):
@@ -173,13 +173,17 @@ def test_vectors():
173
173
print (' Expected key:' , pubkey .hex ().upper ())
174
174
print (' Actual key:' , pubkey_actual .hex ().upper ())
175
175
aux_rand = bytes .fromhex (aux_rand )
176
- sig_actual = schnorr_sign (msg , seckey , aux_rand )
177
- if sig == sig_actual :
178
- print (' * Passed signing test.' )
179
- else :
180
- print (' * Failed signing test.' )
181
- print (' Expected signature:' , sig .hex ().upper ())
182
- print (' Actual signature:' , sig_actual .hex ().upper ())
176
+ try :
177
+ sig_actual = schnorr_sign (msg , seckey , aux_rand )
178
+ if sig == sig_actual :
179
+ print (' * Passed signing test.' )
180
+ else :
181
+ print (' * Failed signing test.' )
182
+ print (' Expected signature:' , sig .hex ().upper ())
183
+ print (' Actual signature:' , sig_actual .hex ().upper ())
184
+ all_passed = False
185
+ except RuntimeError as e :
186
+ print (' * Signing test raised exception:' , e )
183
187
all_passed = False
184
188
result_actual = schnorr_verify (msg , pubkey , sig )
185
189
if result == result_actual :
0 commit comments