(self)
| 255 | True) |
| 256 | |
| 257 | def test_sign(self): |
| 258 | key = CBitcoinSecret('5KJvsngHeMpm884wtkJNzQGaCErckhHJBGFsvd3VyK5qMZXj3hS') |
| 259 | hash = b'\x00' * 32 |
| 260 | sig = key.sign(hash) |
| 261 | |
| 262 | # Check a valid signature |
| 263 | self.assertTrue(key.pub.verify(hash, sig)) |
| 264 | self.assertTrue(IsLowDERSignature(sig)) |
| 265 | |
| 266 | # Check that invalid hash returns false |
| 267 | self.assertFalse(key.pub.verify(b'\xFF'*32, sig)) |
| 268 | |
| 269 | # Check that invalid signature returns false. |
| 270 | # |
| 271 | # Note the one-in-four-billion chance of a false positive :) |
| 272 | self.assertFalse(key.pub.verify(hash, sig[0:-4] + b'\x00\x00\x00\x00')) |
| 273 | |
| 274 | def test_sign_invalid_hash(self): |
| 275 | key = CBitcoinSecret('5KJvsngHeMpm884wtkJNzQGaCErckhHJBGFsvd3VyK5qMZXj3hS') |
nothing calls this directly
no test coverage detected