Start to implement devices enrollment

This commit is contained in:
2024-07-01 21:10:45 +02:00
parent 378c296e71
commit 9ba4aa5194
21 changed files with 267 additions and 16 deletions

View File

@@ -21,7 +21,6 @@ with open(args.secure_origin_path, "r") as f:
print(f"Secure origin = {args.secure_origin}")
print("Check system root CA")
if not os.path.isfile(args.root_ca_path):
origin = api.get_root_ca()
@@ -43,3 +42,12 @@ if not os.path.isfile(args.dev_csr_path):
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)
print("Check device enrollment...")
if not os.path.isfile(args.dev_crt_path):
with open(args.dev_csr_path, "r") as f:
csr = "".join(f.read())
print("Enrolling device...")
crt = api.enroll_device(csr)
print("res" + crt)