windows OpenSSL 在 PKCS12 导出期间挂起,并显示“将‘屏幕’加载到随机状态”
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/34156938/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
OpenSSL hangs during PKCS12 export with "Loading 'screen' into random state"
提问by TN.
I am generating a self-signed SSL certificate with OpenSSL (not makecert), for use in IIS.
我正在生成一个带有 OpenSSL(不是 makecert)的自签名 SSL 证书,用于 IIS。
openssl req -x509 -newkey rsa:2048 -keyout key.pem -out cert.pem -days 365 -nodes -subj '//CN=myhost'
(The double slash is correct. The command above does not work without that.)
(双斜杠是正确的。没有它,上面的命令就不起作用。)
openssl pkcs12 -export -out key.pfx -inkey key.pem -in cert.pem -name 'myhost'
The first command runs completes successfully. However the second get stuck with
第一个命令运行成功完成。但是第二个卡住了
Loading 'screen' into random state -
将“屏幕”加载到随机状态 -
I am using OpenSSL (1.0.2d) that comes with Git for Windows (2.6.3). Anyone experiences the same issue?
我正在使用 Windows 版 Git (2.6.3) 附带的 OpenSSL (1.0.2d)。任何人都遇到同样的问题?
Clarification:Question How to fix "unable to write 'random state' " in openssldescribes different -- problem with writing the the .rnd file. Here the problem seems to be generating the random state. (And only in the second command.)
澄清:问题如何解决 openssl中的“无法写入‘随机状态’”描述了不同的问题——写入 .rnd 文件的问题。这里的问题似乎是生成随机状态。(并且仅在第二个命令中。)
回答by Slawomir Jaranowski
Please try to add winpty
before oppenssl:
请尝试winpty
在oppenssl之前添加:
winpty openssl ...
or you can run a new bash wrapped by winpty:
或者您可以运行由 winpty 包装的新 bash:
winpty bash
In the windows console, there is some problem with terminal input/output so winpty can help if some software requires unix
terminal behavior.
在 Windows 控制台中,终端输入/输出存在一些问题,因此如果某些软件需要unix
终端行为,winpty 可以提供帮助。
winpty
helped me to run openssl in this environment:
winpty
帮助我在这种环境中运行 openssl:
git version 2.7.3.windows.1
OpenSSL 1.0.2g 1 Mar 2016
回答by Duncan Smart
I found that I needed to specify the PFX password on the command line using -passout pass:SomePassword
- e.g.:
我发现我需要使用-passout pass:SomePassword
- 例如在命令行上指定 PFX 密码:
openssl pkcs12 -export -out foo_example_com.pfx -inkey foo_example_com.key -in foo_example_com.crt -passout pass:Pa55w0rd