Beispiel #1
0
    def verifyTxSig(self, tx_bytes, sig, K, prevout_n, prevout_script,
                    prevout_value):
        tx = self.loadTx(tx_bytes)
        sig_hash = SegwitV0SignatureHash(prevout_script, tx, prevout_n,
                                         SIGHASH_ALL, prevout_value)

        pubkey = PublicKey(K)
        return pubkey.verify(sig[:-1], sig_hash,
                             hasher=None)  # Pop the hashtype byte
Beispiel #2
0
 def verifySig(self, pubkey, signed_hash, sig):
     pubkey = PublicKey(pubkey)
     return pubkey.verify(sig, signed_hash, hasher=None)
 def test_verify(self):
     public_key = PublicKey(PUBLIC_KEY_COMPRESSED)
     assert public_key.verify(SIGNATURE, MESSAGE)