【问题标题】:using openssl creating csr for localhost使用 openssl 为 localhost 创建 csr
【发布时间】:2013-01-13 23:02:30
【问题描述】:

我正在使用 openssl(在 Windows 上)创建一个 csr 以使用(测试试用)证书。我以前从未这样做过,我有一个问题: 创建私钥后,您将创建一个 csr 文件,并要求您提供个人信息。它要求您做的一件事是 Common Name,即域名。我目前只运行本地主机。我正在练习如何创建一个 https:// 网站。

问题:我可以通过 localhost:82 之类的操作来创建有效的 csr 吗?如果没有,我该怎么办?

【问题讨论】:

    标签: openssl csr


    【解决方案1】:

    简单的答案:打开您的hosts 文件(C:\Windows\System32\drivers\etc\hosts)并想出一个花哨的域名:

    # Copyright (c) 1993-2009 Microsoft Corp.
    #
    # This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
    #
    # This file contains the mappings of IP addresses to host names. Each
    # entry should be kept on an individual line. The IP address should
    # be placed in the first column followed by the corresponding host name.
    # The IP address and the host name should be separated by at least one
    # space.
    #
    # Additionally, comments (such as these) may be inserted on individual
    # lines or following the machine name denoted by a '#' symbol.
    #
    # For example:
    #
    #      102.54.94.97     rhino.acme.com          # source server
    #       38.25.63.10     x.acme.com              # x client host
    
    # localhost name resolution is handled within DNS itself.
    #       ::1             localhost
    127.0.0.1       localhost
    
    127.0.0.1       example.com  # <<< Your fancy domain goes here !!!
    

    然后,告诉您的网络服务器向 example.com 提供 HTTPS 请求。

    【讨论】:

    • 必须是 www.example.com 吗?我需要重新启动计算机还是什么?而且,如果我使用端口 82,而不是 80(出于技术原因),它必须是 example.com:82 吗?
    • 不,您可以随意命名(例如 google.com 也可以)。 hosts 文件优先于 DNS 查找,所以从字面上看,选择任何你喜欢的东西。回答您的另一个问题:您没有在 CSR 中指定特定端口,通用名称基本上是您的域或子域(如果您想保护 www.example.com)。
    • 好的,谢谢。我想我现在只使用 localhost 本身,因为从您所说的看来,这与 example.com 一样好。一旦我让它上线,我将生成一个新的密钥和 csr。
    猜你喜欢
    • 1970-01-01
    • 2020-03-09
    • 1970-01-01
    • 1970-01-01
    • 2016-10-17
    • 2017-10-15
    • 1970-01-01
    • 2014-03-11
    • 1970-01-01
    相关资源
    最近更新 更多