Ejemplo n.º 1
0
 def create_certificate(self, csr, issuer_options):
     adcs_server = current_app.config.get('ADCS_SERVER')
     adcs_user = current_app.config.get('ADCS_USER')
     adcs_pwd = current_app.config.get('ADCS_PWD')
     adcs_auth_method = current_app.config.get('ADCS_AUTH_METHOD')
     adcs_template = current_app.config.get('ADCS_TEMPLATE')
     ca_server = Certsrv(adcs_server, adcs_user, adcs_pwd, auth_method=adcs_auth_method)
     current_app.logger.info("Requesting CSR: {0}".format(csr))
     current_app.logger.info("Issuer options: {0}".format(issuer_options))
     cert, req_id = ca_server.get_cert(csr, adcs_template, encoding='b64').decode('utf-8').replace('\r\n', '\n')
     chain = ca_server.get_ca_cert(encoding='b64').decode('utf-8').replace('\r\n', '\n')
     return cert, chain, req_id
Ejemplo n.º 2
0
 def create_certificate(self, csr, issuer_options):
     adcs_server = current_app.config.get("ADCS_SERVER")
     adcs_user = current_app.config.get("ADCS_USER")
     adcs_pwd = current_app.config.get("ADCS_PWD")
     adcs_auth_method = current_app.config.get("ADCS_AUTH_METHOD")
     adcs_template = current_app.config.get("ADCS_TEMPLATE")
     ca_server = Certsrv(adcs_server,
                         adcs_user,
                         adcs_pwd,
                         auth_method=adcs_auth_method)
     current_app.logger.info("Requesting CSR: {0}".format(csr))
     current_app.logger.info("Issuer options: {0}".format(issuer_options))
     cert = (ca_server.get_cert(csr, adcs_template,
                                encoding="b64").decode("utf-8").replace(
                                    "\r\n", "\n"))
     chain = (ca_server.get_ca_cert(encoding="b64").decode("utf-8").replace(
         "\r\n", "\n"))
     return cert, chain, None
Ejemplo n.º 3
0
 def create_certificate(self, csr, issuer_options):
     adcs_server = current_app.config.get("ADCS_SERVER")
     adcs_user = current_app.config.get("ADCS_USER")
     adcs_pwd = current_app.config.get("ADCS_PWD")
     adcs_auth_method = current_app.config.get("ADCS_AUTH_METHOD")
     # if there is a config variable ADCS_TEMPLATE_<upper(authority.name)> take the value as Cert template
     # else default to ADCS_TEMPLATE to be compatible with former versions
     authority = issuer_options.get("authority").name.upper()
     adcs_template = current_app.config.get(
         "ADCS_TEMPLATE_{0}".format(authority),
         current_app.config.get("ADCS_TEMPLATE"))
     ca_server = Certsrv(adcs_server,
                         adcs_user,
                         adcs_pwd,
                         auth_method=adcs_auth_method)
     current_app.logger.info("Requesting CSR: {0}".format(csr))
     current_app.logger.info("Issuer options: {0}".format(issuer_options))
     cert = (ca_server.get_cert(csr, adcs_template,
                                encoding="b64").decode("utf-8").replace(
                                    "\r\n", "\n"))
     chain = (ca_server.get_ca_cert(encoding="b64").decode("utf-8").replace(
         "\r\n", "\n"))
     return cert, chain, None