如何终止从一个批处理文件的OpenSSL的握手? [英] How to terminate an openssl handshake from a batch file?

查看:117
本文介绍了如何终止从一个批处理文件的OpenSSL的握手?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经写一个PHP程序来执行批处理文件,它包含OpenSSL的命令:

I have written a PHP program to execute a batch file which contains openssl commands:

openssl s_client -showcerts -connect google.com:443 >test.cert

考虑这个批处理文件,即test.cert的输出,我运行具有以下命令另一个批处理文件:

Taking the output of this batch file ie test.cert, I run another batch file which has these commands :

openssl x509 -noout -in test.cert -dates >date.txt
openssl x509 -noout -in test.cert -issuer >issuer.txt

但问题是,第一批处理文件不会终止,因为CMD正在等待握手完成。所以,第二个批处理文件不运行。我如何终止第一个批处理文件?

But the problem is that the first batch file does not terminate because the cmd is waiting for handshake completion. So, the second batch file does not run. How do I terminate the first batch file?

推荐答案

的OpenSSL的s_client.First 等待输入所以你要终止的连接不握手。
最简单的方法是改变

openssl s_client waits for input so you have to terminate the connection not the handshake. the easiest way would be to change

 openssl s_client -showcert -connect google.com:443 > test.cert

 openssl s_client -showcert -connect google.com:443 < /dev/null > test.cert

这应该关闭它成立之后的连接。

this should close the connection right after it was established.

这篇关于如何终止从一个批处理文件的OpenSSL的握手?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆