我正在尝试在 XAMPP、Windows 10 上安装 SSL 证书,但无论我做什么,我都会收到此错误:
22632:error:28069065:lib(40):UI_set_result:result too small:.\crypto\ui\ui_lib.c:830:You must type in 4 to 511 characters
22632:error:0906406D:PEM routines:PEM_def_callback:problems getting password:.\crypto\pem\pem_lib.c:116:
22632:error:0907E06F:PEM routines:DO_PK8PKEY:read key:.\crypto\pem\pem_pk8.c:130:
unable to load Private Key
18224:error:0906D06C:PEM routines:PEM_read_bio:no start line:.\crypto\pem\pem_lib.c:707:Expecting: ANY PRIVATE KEY
server.csr: No such file or directory
Could Not Find c:\xampp\apache\server.csr
The system cannot find the file specified.
The system cannot find the file specified.
-----
Das Zertifikat wurde erstellt.
The certificate was provided.
Press any key to continue . . .
制作证书.bat:
@echo off
set OPENSSL_CONF=./conf/openssl.cnf
if not exist .\conf\ssl.crt mkdir .\conf\ssl.crt
if not exist .\conf\ssl.key mkdir .\conf\ssl.key
bin\openssl req -new -out server.csr
bin\openssl rsa -in privkey.pem -out server.key
bin\openssl x509 -in server.csr -out server.crt -req -signkey server.key -days 365
set OPENSSL_CONF=
del .rnd
del privkey.pem
del server.csr
move /y server.crt .\conf\ssl.crt
move /y server.key .\conf\ssl.key
pause
看起来 server.crt
、server.csr
和 server.key
已创建,它们位于 conf/sll 中。 .. 如 makecert.bat 所述,我也尝试过其他密码但没有成功。
设置 set OPENSSL_CONF=C:\xampp\apache\conf\openssl.cnf
也无济于事,将 openssl.cnf
更改为 openssl 也无济于事.cfg
(就像一些人在其他相关的 SO 问题上建议的那样)。
我用这个问题在 google 上发了好几个小时,Stack Overflow 的答案似乎也没有帮助。
编辑: 添加图像以显示即使使用全新的 pem
文件也会出现此问题。 (出于测试目的,我将 pem
文件名更改为 privkey77.pem
,显然我得到了同样的错误)。
编辑 #2: 即使使用 openssl genrsa -des3 -out mykey.pem 2048
创建带密码的新 key 也会返回:27492:error:28069065: lib(40):UI_set_result:result too small:.\crypto\ui\ui_lib.c:830:You must type in 4 to 1023 characters
.
所以出于某种原因,我基本上无法使用密码创建 pem
文件。
有人可以帮忙吗?
最佳答案
我设法通过将 -nodes
arg 传递到触发错误的行来避免此错误,如建议的那样 here .
我的 makecert.bat
文件的第 7 行如下所示:
bin\openssl req -new -out server.csr -nodes
此参数完全禁用身份验证。我不知道这是否对证书有任何副作用,因为我还没有设法让它发挥作用,我也不知道为什么。 (可能是因为这个,也可能是其他原因)
关于apache - 本地 SSL 证书返回错误 "result too small", "problems getting password",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50613724/