|
|
@@ -6,7 +6,7 @@ import ecdsa |
|
|
|
# CREDITS : https://gist.github.com/cjies/cc014d55976db80f610cd94ccb2ab21e |
|
|
|
pri = ecdsa.SigningKey.generate(curve=ecdsa.NIST256p) |
|
|
|
pub = pri.get_verifying_key() |
|
|
|
private = base64.urlsafe_b64encode(pri.to_string()).decode("utf-8").strip("="), |
|
|
|
private = base64.urlsafe_b64encode(pri.to_string()).decode("utf-8").strip("=") |
|
|
|
public = base64.urlsafe_b64encode(b"\x04" + pub.to_string()).decode("utf-8").strip("=") |
|
|
|
|
|
|
|
import pathlib |
|
|
@@ -19,3 +19,8 @@ with open(keydir / 'public_key.txt', 'w') as fp: |
|
|
|
|
|
|
|
with open(keydir / 'private_key.txt', 'w') as fp: |
|
|
|
print(private, file=fp) |
|
|
|
|
|
|
|
with open(keydir / 'private_key.pem', 'wb') as fp: |
|
|
|
#print(pri.to_pem(), file=fp) |
|
|
|
# ecdsa is broken, to_pem returns bytes instead of a str |
|
|
|
fp.write(pri.to_pem()) |