Example #1
0
 def verify(self, sig, msg):
     assert isinstance(sig, type("")) # string, really bytes
     assert len(sig) == 64
     sig_R = sig[:32]
     sig_S = sig[32:]
     sig_and_msg = sig_R + sig_S + msg
     # this might raise BadSignatureError
     msg2 = _ed25519.open(sig_and_msg, self.vk_bytes)
     assert msg2 == msg
Example #2
0
 def verify(self, sig, msg, prefix="", encoding=None):
     assert isinstance(sig, type("")) # string, really bytes
     if encoding:
         sig = from_ascii(sig, prefix, encoding)
     else:
         sig = remove_prefix(sig, prefix)
     assert len(sig) == 64
     sig_R = sig[:32]
     sig_S = sig[32:]
     sig_and_msg = sig_R + sig_S + msg
     # this might raise BadSignatureError
     msg2 = _ed25519.open(sig_and_msg, self.vk_s)
     assert msg2 == msg