This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from cryptography import x509 | |
from cryptography.hazmat.backends import default_backend | |
from cryptography.hazmat.primitives.asymmetric import rsa, ec, ed25519 | |
from cryptography.hazmat.primitives import hashes, serialization | |
def make_privkey(key_type): | |
if key_type == 'ec' or key_type == 'ecdsa': | |
privkey = ec.generate_private_key( | |
ec.SECP256R1(), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
import json | |
import base64 | |
with open(sys.argv[1]) as fp: | |
pkey = json.load(fp) | |
print('asn1=SEQUENCE:private_key\n[private_key]') | |
print('version=INTEGER:0') | |
for k,v in pkey.items(): |