openssl 挂起并且不退出 [英] openssl hangs and does not exit
问题描述
我正在尝试使用 openssl 获取证书,但它似乎一直挂着.我进行了大量研究,但并非所有可用选项似乎都适用于 Windows.
I am trying to use openssl to get a certificate, and it seems to keep hanging. I have done a lot of research but not all of the available options seem to work on Windows.
openssl s_client -showcerts -connect google.com:443 > cert.txt
我已经试过了:
openssl s_client -connect xyz:443 < quit.txt > cert.txt
其中 quit.txt
包含quit
"来自 http://bytes.com/主题/php/answers/8802-automate-openssl-s_client-command-batch-php-script
Where quit.txt
contains "quit
"
from http://bytes.com/topic/php/answers/8802-automate-openssl-s_client-command-batch-php-script
那没有用.我还查看了 Openssl s_clinet -connect 脚本.强制退出帮助
That did not work. I also looked at Openssl s_clinet -connect scripting. Force quit help
我也试过 -prexit
我也研究过这个,但无法让它工作:https://serverfault.com/questions/139728/how-to-从网站下载 ssl 证书
I have also looked into this as well and can't get it working: https://serverfault.com/questions/139728/how-to-download-ssl-certificate-from-a-website
我做得很好!我设法做了一些我认为不可能的事情,像这个错误这样的简单事情成功地阻止了我暂时:(
I was doing so well! I managed to do something that I thought would be impossible and a simple thing like this bug managed to stop me for the time being :(
推荐答案
看起来一些适用于 Windows 的 OpenSSL 发行版需要额外的按键,独立于标准输入.Quit.txt 被正确地传送到 openssl 的 STDIN(服务器接收 QUIT 命令),但在您按下任意键之前什么也不会发生.
It looks like some OpenSSL distributions for Windows are expecting an additional keypress, independant of standard input. Quit.txt gets correctly piped into openssl's STDIN (the server receives QUIT command), but nothing happens until you press any key.
此问题在 Cygwin 的 版本的 OpenSSL 中不存在.不幸的是,Cygwin 的基本安装需要大约 100 MB 的磁盘空间,但您可以尝试仅提取 openssl.exe 和所需的库.
This problem does not exist in Cygwin's version of OpenSSL. Unfortunatly base installation of Cygwin takes about 100 MB of disk space, but you can try to extract only openssl.exe and required libraries.
此方法有效:
echo QUIT | c:cygwininopenssl.exe s_client -showcerts -connect google.com:443 > cert.txt
这篇关于openssl 挂起并且不退出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!