【问题标题】:creating self-signed certificates with open ssl on windows在 Windows 上使用开放 ssl 创建自签名证书
【发布时间】:2017-01-09 07:21:07
【问题描述】:

我正在关注these guidelines 使用 OpenSSL 生成自签名证书。

我在Windows 10下,我的工作目录如下:

PS E:\Certificats\predix\root\ca> ls


    Directory: E:\Certificats\predix\root\ca


Mode                LastWriteTime         Length Name
----                -------------         ------ ----
d-----         9/1/2016  11:57 AM                certs
d-----         9/1/2016  11:55 AM                crl
d-----         9/1/2016  12:00 PM                intermediate
d-----         9/1/2016  11:55 AM                newcerts
d-----         9/1/2016  11:56 AM                private
-a----         9/1/2016  11:55 AM              2 index.txt
-a----         9/1/2016  11:56 AM           4306 openssl.cnf
-a----         9/1/2016  11:55 AM             14 serial

在指南中的几个步骤之后,当我键入时

openssl ca -config openssl.cnf -extensions v3_intermediate_ca -days 3650 -notext -md s

我收到以下错误

Using configuration from openssl.cnf
Enter pass phrase for ./private/ca.key.pem:
unable to load number from ./serial
error while loading serial number
12944:error:0D066096:asn1 encoding routines:a2i_ASN1_INTEGER:short line:.\crypto\asn1\f_int.c:212:
PS E:\Certificats\predix\root\ca> openssl ca -config openssl.cnf -extensions v3_intermediate_ca -days 3650 -notext -md sha256 -in intermediate/csr/intermediate.csr.pem  -out intermediate/certs/intermediate.cert.pem
Using configuration from openssl.cnf

告诉我读取串行文件时出现问题。

连载内容是

1000

有没有人可以解决这个问题?该文件存在且其在conf文件中的路径名是正确的...

【问题讨论】:

标签: openssl


【解决方案1】:

自己解决了这个问题:我使用

创建了串行文件
echo 00 > serial

它生成了一个 Unicode 文件,而 openssl 期待一个 ANSI 文件。

【讨论】:

    【解决方案2】:

    对于在应用以下建议的答案后仍然收到错误的其他人:

    PS> echo 00 > serial
    unable to load number from ./serial
    error while loading serial number
    29488:error:0D066096:asn1 encoding routines:a2i_ASN1_INTEGER:short line:crypto\asn1\f_int.c:140:
    

    我可以通过在Git Bash 终端中运行相同的命令来解决此问题。这会将文件放置在适合 openssl 的格式中。

    【讨论】:

      【解决方案3】:

      我也很惊讶,但 PowerShell 默认写入 UTF-16 文件。更多详情here.

      OpenSSL 不能识别 UTF-16 和 UTF-8 BOM。

      因此,您可以使用Out-File 代替echo 00 > serial 来编写纯ASCII 文件:

      "00" | Out-File -encoding ascii -NoNewline "serial"
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2014-11-20
        • 1970-01-01
        • 2014-03-02
        • 2017-02-18
        • 2020-10-25
        相关资源
        最近更新 更多