Exemple #1
0
def _get_certificate_part1(statefile, account_key, csr, acme_dir, CA, email):
    sys.stderr.write("Preparing challenges...")
    state = acme_lib.get_challenges(account_key, csr, CA, email_address=email)
    sys.stderr.write(" ok\n")
    sys.stderr.write("Writing challenges...")
    acme_lib.write_challenges(state, acme_dir)
    sys.stderr.write(" ok\n")
    sys.stderr.write("Serializing state...")
    with open(statefile, "w") as sf:
        sf.write(acme_lib.serialize_state(state))
    sys.stderr.write(" ok\n")
Exemple #2
0
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)