Exemple #1
0
    def test_lets_encrypt_sanity(self):

        # We need a fake account key and crt
        import subprocess
        proc = subprocess.Popen(["openssl genrsa 2048 > /tmp/account.key"],
                                stdin=subprocess.PIPE,
                                stdout=subprocess.PIPE,
                                stderr=subprocess.PIPE,
                                shell=True)
        out, err = proc.communicate()
        if proc.returncode != 0:
            raise IOError("OpenSSL Error: {0}".format(err))
        proc = subprocess.Popen([
            "openssl req -x509 -newkey rsa:2048 -subj '/C=US/ST=Denial/L=Springfield/O=Dis/CN=www.example.com' -passout pass:foo -keyout /tmp/key.key -out test_signed.crt -days 1 > /tmp/signed.crt"
        ],
                                stdin=subprocess.PIPE,
                                stdout=subprocess.PIPE,
                                stderr=subprocess.PIPE,
                                shell=True)
        out, err = proc.communicate()
        if proc.returncode != 0:
            raise IOError("OpenSSL Error: {0}".format(err))

        DEFAULT_CA = "https://acme-staging.api.letsencrypt.org"
        CA = "https://acme-staging.api.letsencrypt.org"

        try:
            result = register_account()
        except ValueError as e:
            pass  # that's fine.

        create_domain_key()
        create_domain_csr('herp.derp.wtf')
        parse_account_key()
        parse_csr()
        create_chained_certificate()

        try:
            result = sign_certificate()
        except ValueError as e:
            pass  # that's fine.

        result = verify_challenge('http://echo.jsontest.com/status/valid')
        try:
            result = verify_challenge('http://echo.jsontest.com/status/fail')
        except ValueError as e:
            pass  # that's fine.
        try:
            result = verify_challenge('http://bing.com')
        except ValueError as e:
            pass  # that's fine.

        encode_certificate(b'123')

        os.remove('test_signed.crt')
        cleanup()
Exemple #2
0
    def test_lets_encrypt_sanity(self):

        # We need a fake account key and crt
        import subprocess
        proc = subprocess.Popen(["openssl genrsa 2048 > /tmp/account.key"],
            stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
        out, err = proc.communicate()
        if proc.returncode != 0:
            raise IOError("OpenSSL Error: {0}".format(err))
        proc = subprocess.Popen(["openssl req -x509 -newkey rsa:2048 -subj '/C=US/ST=Denial/L=Springfield/O=Dis/CN=www.example.com' -passout pass:foo -keyout /tmp/key.key -out test_signed.crt -days 1 > /tmp/signed.crt"],
            stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
        out, err = proc.communicate()
        if proc.returncode != 0:
            raise IOError("OpenSSL Error: {0}".format(err))

        DEFAULT_CA = "https://acme-staging.api.letsencrypt.org"
        CA = "https://acme-staging.api.letsencrypt.org"

        try:
            result = register_account()
        except ValueError as e:
            pass # that's fine.

        create_domain_key()
        create_domain_csr('herp.derp.wtf')
        parse_account_key()
        parse_csr()
        create_chained_certificate()

        try:
            result = sign_certificate()
        except ValueError as e:
            pass # that's fine.

        result = verify_challenge('http://echo.jsontest.com/status/valid')
        try:
            result = verify_challenge('http://echo.jsontest.com/status/fail')
        except ValueError as e:
            pass # that's fine.
        try:
            result = verify_challenge('http://bing.com')
        except ValueError as e:
            pass # that's fine.

        encode_certificate(b'123')

        os.remove('test_signed.crt')
        cleanup()