chatgpt/encryption-on-apis/verify.py
2022-12-17 22:39:21 +02:00

26 lines
576 B
Python
Executable File

#!/usr/bin/python3
import ecdsa
import sys
# read the original message from the first command-line argument
message = sys.argv[1]
# read the signature from standard input
signature = sys.stdin.read()
# read the public key from the second command-line argument
public_key = sys.argv[2]
print('message: ', message)
print('signature: ', signature)
print('public key: ', public_key)
# generate a verifying key from the public key
vk = ecdsa.VerifyingKey.from_string(public_key, curve=ecdsa.SECP256k1)
# verify the signature
#assert vk.verify(signature, message.encode())