def _get_intermediate(intermediate_url, cert): ic = acme_lib.download_certificate(intermediate_url) if cert is None: sys.stdout.write(ic + '\n') else: acme_lib.write_file(cert, ic + '\n') sys.stderr.write("Stored intermediate certificate at '{0}'.\n".format(cert))
def _gen_csr(domains, key, csr): if csr.endswith('.csr'): config_filename = csr[:-4] + '.cnf' else: config_filename = csr + '.cnf' sys.stderr.write('Writing OpenSSL config to {0}.\n'.format(config_filename)) the_csr = acme_lib.generate_csr(key, config_filename, domains.split(',')) acme_lib.write_file(csr, the_csr)
def _get_certificate_part2(statefile, csr, cert): sys.stderr.write("Deserializing state...") with open(statefile, "r") as sf: state = acme_lib.deserialize_state(sf.read()) sys.stderr.write(" ok\n") sys.stderr.write("Verifying challenges...") acme_lib.verify_challenges(state) sys.stderr.write(" ok\n") sys.stderr.write("Notifying CA of challenges...") acme_lib.notify_challenges(state) sys.stderr.write(" ok\n") sys.stderr.write("Verifying domains...\n") result = acme_lib.check_challenges(state, csr, lambda domain: sys.stderr.write("Verified domain {0}!\n".format(domain))) sys.stderr.write("Certificate is signed!\n") if cert is None: sys.stdout.write(result) else: acme_lib.write_file(cert, result) sys.stderr.write("Stored certificate at '{0}'.\n".format(cert))
def _get_certificate(account_key, csr, acme_dir, CA, cert, email): sys.stderr.write("Preparing challenges...") state = acme_lib.get_challenges(account_key, csr, CA, email_address=email) sys.stderr.write(" ok\n") try: sys.stderr.write("Writing and verifying challenges...") acme_lib.write_challenges(state, acme_dir) acme_lib.verify_challenges(state) sys.stderr.write(" ok\n") sys.stderr.write("Notifying CA of challenges...") acme_lib.notify_challenges(state) sys.stderr.write(" ok\n") sys.stderr.write("Verifying domains...\n") result = acme_lib.check_challenges(state, csr, lambda domain: sys.stderr.write("Verified domain {0}!\n".format(domain))) sys.stderr.write("Certificate is signed!\n") if cert is None: sys.stdout.write(result) else: acme_lib.write_file(cert, result) sys.stderr.write("Stored certificate at '{0}'.\n".format(cert)) finally: acme_lib.remove_challenges(state, acme_dir)
def _gen_account_key(account_key, key_length, algorithm): key = acme_lib.create_key(key_length=key_length, algorithm=algorithm) acme_lib.write_file(account_key, key)
def _gen_cert_key(key, key_length, algorithm): the_key = acme_lib.create_key(key_length=key_length, algorithm=algorithm) acme_lib.write_file(key, the_key)
def _gen_account_key(account_key, key_length): key = acme_lib.create_key(key_length=key_length) acme_lib.write_file(account_key, key)
def _gen_cert_key(key, key_length): the_key = acme_lib.create_key(key_length=key_length) acme_lib.write_file(key, the_key)