File tree Expand file tree Collapse file tree 2 files changed +19
-4
lines changed Expand file tree Collapse file tree 2 files changed +19
-4
lines changed Original file line number Diff line number Diff line change @@ -100,18 +100,24 @@ def hmac_compat(data):
100100 return bytes (data )
101101 return data
102102
103+ def normalise_bytes (buffer_object ):
104+ """Cast the input into array of bytes."""
105+ if not buffer_object :
106+ return b""
107+ return memoryview (buffer_object ).cast ("B" )
108+
103109 else :
104110
105111 def hmac_compat (data ):
106112 return data
107113
114+ def normalise_bytes (buffer_object ):
115+ """Cast the input into array of bytes."""
116+ return memoryview (buffer_object ).cast ("B" )
117+
108118 def compat26_str (val ):
109119 return val
110120
111- def normalise_bytes (buffer_object ):
112- """Cast the input into array of bytes."""
113- return memoryview (buffer_object ).cast ("B" )
114-
115121 def remove_whitespace (text ):
116122 """Removes all whitespace from passed in string"""
117123 return re .sub (r"\s+" , "" , text , flags = re .UNICODE )
Original file line number Diff line number Diff line change @@ -550,6 +550,15 @@ def test_equality_on_signing_keys(self):
550550 self .assertEqual (self .sk1 , sk )
551551 self .assertEqual (self .sk1_pkcs8 , sk )
552552
553+ def test_verify_with_empty_message (self ):
554+ sig = self .sk1 .sign (b"" )
555+
556+ self .assertTrue (sig )
557+
558+ vk = self .sk1 .verifying_key
559+
560+ self .assertTrue (vk .verify (sig , b"" ))
561+
553562 def test_verify_with_precompute (self ):
554563 sig = self .sk1 .sign (b"message" )
555564
You can’t perform that action at this time.
0 commit comments