Sign CSR
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
from src.args import args
|
||||
import src.api as api
|
||||
import src.pki as pki
|
||||
import src.utils as utils
|
||||
import os
|
||||
|
||||
print("Check storage")
|
||||
@@ -28,8 +29,17 @@ if not os.path.isfile(args.root_ca_path):
|
||||
f.write(origin)
|
||||
|
||||
print("Check private key")
|
||||
if not os.path.isfile(args.dev_priv_key):
|
||||
if not os.path.isfile(args.dev_priv_key_path):
|
||||
print("Generate private key...")
|
||||
key = pki.gen_priv_key()
|
||||
with open(args.dev_priv_key, "w") as f:
|
||||
with open(args.dev_priv_key_path, "w") as f:
|
||||
f.write(key)
|
||||
|
||||
print("Check CSR")
|
||||
if not os.path.isfile(args.dev_csr_path):
|
||||
print("Generate CSR...")
|
||||
with open(args.dev_priv_key_path, "r") as f:
|
||||
priv_key = "".join(f.readlines())
|
||||
csr = pki.gen_csr(priv_key=priv_key, cn=f"PyDev {utils.rand_str(10)}")
|
||||
with open(args.dev_csr_path, "w") as f:
|
||||
f.write(csr)
|
||||
|
||||
Reference in New Issue
Block a user