File tree Expand file tree Collapse file tree 1 file changed +14
-0
lines changed
Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -181,6 +181,20 @@ def test_ec_verify_should_return_false_if_signature_invalid(self):
181181 result = algo .verify (message , pub_key , sig )
182182 assert not result
183183
184+ @pytest .mark .skipif (not has_crypto , reason = 'Not supported without cryptography library' )
185+ def test_ec_verify_should_return_false_if_signature_wrong_length (self ):
186+ algo = ECAlgorithm (ECAlgorithm .SHA256 )
187+
188+ message = ensure_bytes ('Hello World!' )
189+
190+ sig = base64 .b64decode (ensure_bytes ('AC+m4Jf/xI3guAC6w0w3' ))
191+
192+ with open (key_path ('testkey_ec.pub' ), 'r' ) as keyfile :
193+ pub_key = algo .prepare_key (keyfile .read ())
194+
195+ result = algo .verify (message , pub_key , sig )
196+ assert not result
197+
184198 @pytest .mark .skipif (not has_crypto , reason = 'Not supported without cryptography library' )
185199 def test_ec_verify_should_return_true_if_signature_valid (self ):
186200 algo = ECAlgorithm (ECAlgorithm .SHA256 )
You can’t perform that action at this time.
0 commit comments