Beispiel #1
0
 def test_deterministic_signatures(self, sk, msg, sig):
     """
     See RFC6979 for explanation
     https://tools.ietf.org/html/rfc6979#section-3.2
     """
     key = Key(sk)
     signature = key.sign(msg)
     self.assertEqual(sig, signature)
Beispiel #2
0
    def sign(self, key):
        if isinstance(key, str):
            key = Key(key)
        if not isinstance(key, Key):
            raise ValueError('Base58 encoded secret key or Key instance required.')

        self._data['signature'] = key.sign(self.unsigned_bytes(), generic=True)
        return self._data['signature']
Beispiel #3
0
 def test_sign_and_verify(self, sk, msg):
     key = Key(sk)
     sig = key.sign(msg)
     key.verify(sig, msg)
     self.assertRaises(ValueError, key.verify, sig, b'fake')