File tree 2 files changed +19
-4
lines changed
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):
100
100
return bytes (data )
101
101
return data
102
102
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
+
103
109
else :
104
110
105
111
def hmac_compat (data ):
106
112
return data
107
113
114
+ def normalise_bytes (buffer_object ):
115
+ """Cast the input into array of bytes."""
116
+ return memoryview (buffer_object ).cast ("B" )
117
+
108
118
def compat26_str (val ):
109
119
return val
110
120
111
- def normalise_bytes (buffer_object ):
112
- """Cast the input into array of bytes."""
113
- return memoryview (buffer_object ).cast ("B" )
114
-
115
121
def remove_whitespace (text ):
116
122
"""Removes all whitespace from passed in string"""
117
123
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):
550
550
self .assertEqual (self .sk1 , sk )
551
551
self .assertEqual (self .sk1_pkcs8 , sk )
552
552
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
+
553
562
def test_verify_with_precompute (self ):
554
563
sig = self .sk1 .sign (b"message" )
555
564
You can’t perform that action at this time.
0 commit comments