Beispiel #1
0
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))
Beispiel #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)