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

22 lines
619 B
Python
Executable File

#!/usr/bin/python3
import sys
import ecdsa
# read in the first argument that should be ecdsa key in hex form
private_key_hex = sys.argv[1]
# Convert the private key from hexadecimal to an integer
private_key_int = int(private_key_hex, 16)
#print(private_key_int)
## Create a signing key object from the private key
signing_key = ecdsa.SigningKey.from_secret_exponent(private_key_int)
# Get the public key from the signing key object
public_key = signing_key.verifying_key
# Print the public key in hexadecimal format
##print(public_key.to_string("uncompressed").hex())
print(public_key.to_string("hybrid").hex())