transactions – The right way to convert signature to DER encoded format in python – CoinNewsTrend

transactions – The right way to convert signature to DER encoded format in python

[ad_1]

vk = ecdsa.VerifyingKey.from_string(bytes.fromhex(pubKey),curve=ecdsa.SECP256k1)

if vk.confirm(bytes.fromhex(signature), bytes.fromhex(sha256_hash), hashlib.sha256, sigdecode=sigdecode_der) == True: # True
        print("Signature is Legitimate")
else:
        print("Signature just isn't Legitimate")

I’m making an attempt to confirm a transaction utilizing secp256k1_generator, however I can not seem to get the signature into the proper (r,s) format, and am getting the next output

 File "/.native/lib/python3.10/site-packages/ecdsa/keys.py", line 741, in verify_digest
    increase BadSignatureError("Signature verification failed")
ecdsa.keys.BadSignatureError: Signature verification failed

I’ve taken assist of Signature verification in python utilizing compressed public key
and

https://stackoverflow.com/questions/73630540/how-to-verify-ecdsa-signatures-with-python
However nonetheless I get this error. How can I resolve it?

[ad_2]

Supply hyperlink