2012-05-01 2 views
1

난하려면 openssl 명령이 포함 된 배치 파일을 실행하는 PHP 프로그램을 작성했습니다 :배치 파일에서 openssl 핸드 셰이크를 종료하는 방법은 무엇입니까?

: 예 test.cert이 배치 파일의 출력을 촬영

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

을, 나는이 명령을 가진 다른 배치 파일을 실행

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

그러나 문제는 cmd가 핸드 셰이크 완료를 기다리고 있기 때문에 첫 번째 배치 파일이 종료되지 않는다는 것입니다. 따라서 두 번째 배치 파일은 실행되지 않습니다. 첫 번째 배치 파일을 어떻게 종료합니까?

답변

3

openssl s_client 입력을 기다리므로 핸드 셰이크가 아닌 연결을 종료해야합니다. 가장 쉬운 방법이 그것이 설립 직후 연결을 종료해야

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

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

로 변경하는 것입니다.

0
> echo 'x' | openssl s_client -showcert -connect google.com:443 > test.cert 
+3

'true | openssl s_client'도 잘 작동합니다. – sanmai

관련 문제