def askCertSign(CName): try: cert = certUtils.signCert(conf.ejbcaApiUrl, conf.certsDir + "/mosca.csr", CName) certUtils.saveCRT(conf.certsDir + "/mosca.crt", cert) print("mosca certificate signed") except certUtils.x509IdentityMgmtException as err: print("Cant sign the CRT. Error from x509-identity-mgmt: " + err.message) exit(-1)
def askCertSign(ejbcaHost, devname): filename = conf.certsDir + "/" + devname + ".crt" if not os.path.isfile(filename) or overwrite: try: cert = certUtils.signCert(ejbcaHost, conf.certsDir + "/" + devname + ".csr", devname, 'dojot') except certUtils.EJBCARESTException as err: print("Cant sign the CRT. EJBCA-REST return code: " + str(err)) exit(-1) certUtils.saveCRT(filename, cert) print(devname + " certificate signed. Avaliable at " + filename) else: print("Certificate file already exists at " + filename + ". Skiping.")
def askCertSign(ejbcaHost, devname, overwrite): filename = conf.certsDir + "/" + devname + ".crt" if not os.path.isfile(filename) or overwrite: try: cert = certUtils.signCert(ejbcaHost, conf.certsDir + "/" + devname + ".csr", devname, 'dojot') except requests.exceptions.HTTPError as err: print("Cant sign the CRT. EJBCA-REST return code: " " EJBCA-REST return code: " + str(err.response.status_code)) print(str(err.response.text)) helperErrorDesc(err.response.status_code) exit(-1) certUtils.saveCRT(filename, cert) print(devname + " certificate signed. Avaliable at " + filename) else: print("Certificate file already exists at " + filename + ". Skiping.")
def askCertSign(): if not os.path.isfile(conf.certsDir + "/mosca.crt"): passwd = binascii.b2a_hex(os.urandom(16)) try: certUtils.createEJBCAUser(conf.EJBCA_API_URL, conf.CAName, "mosca", passwd) except certUtils.EJBCARESTException as err: print("Cant create EJBCA user. Error: " + err.message) exit(-1) try: cert = certUtils.signCert(conf.EJBCA_API_URL, conf.certsDir + "/mosca.csr", "mosca", passwd) except certUtils.EJBCARESTException as err: print("Cant sign the CRT. EJBCA-REST return code: " + err.message) exit(-1) certUtils.saveCRT(conf.certsDir + "/mosca.crt", cert) print("mosca certificate signed")