def certificateUpdate():
print art
print "\nCertificate Update Script - Block SSL\n"
# create a key pair or use the old one
ans = raw_input("Do you have your old keys.key file with your key pair? [Y]es [N]o, default: [Y]\n")
if ans == "n" or ans == "N":
k = crypto.PKey()
k.generate_key(crypto.TYPE_RSA, 4096)
print "Creating a new key pair:"
print "Warning: This is a pseudo-random generation.\n"
else:
print "Place your keys.key file in the scripts directory.\n"
k = crypto.PKey()
with open("keys.key", "r") as k:
k = crypto.load_privatekey(crypto.FILETYPE_PEM, k.read())
# create a self-signed cert
cert = crypto.X509()
createCert(k, cert)
open("certificate.crt", "wt").write(crypto.dump_certificate(crypto.FILETYPE_PEM, cert))
print "\nCertificate created in file: certificate.crt"
if ans == "n" or ans == "N":
open("keys.key", "wt").write(crypto.dump_privatekey(crypto.FILETYPE_PEM, k))
print "\nKeys saved in file: keys.key\n"
ans2 = raw_input("Do you want to send your certificate to the blockchain? [Y]es [N]o, default: [Y]")
if ans2 == "Y" or ans2 == "y" or ans2 == "" or ans2 == " ":
i = 2
sendCertificate(i)
sys.exit()
评论列表
文章目录