Openssl Command Hangs

openssl hangs and does not exit

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.

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.

This method works:

echo QUIT | c:\cygwin\bin\openssl.exe s_client -showcerts -connect google.com:443 > cert.txt

OpenSSL hangs during PKCS12 export with Loading 'screen' into random state

Please try to add winpty before oppenssl:

winpty openssl ...

or you can run a new bash wrapped by winpty:

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.

winpty helped me to run openssl in this environment:

git version 2.7.3.windows.1
OpenSSL 1.0.2g 1 Mar 2016

openssl command hangs

You need another argument, it expects to read a certificate from standard input. Probably you meant to add -new as a command line argument, or you need to pass an existing certificate on standard in.

Creating CSR with OpenSSL hangs

It should have -new:

ECHO Creating certificate sign request (CSR) -------------
openssl req -new -key %1.key -out %1.csr

Openssl output hanging when getting -enddate

It's easier to start small and build up rather than to start big and debug down.

Here's an easier way to reproduce your problem, which also just hangs:

openssl s_client -connect google.com:443

Now that the problem is so simple and narrow, googling "why would openssl s_client hang?" leads to useful information recommending echo -n | ... to "give a response to the server, so that the connection is released". That should be sufficient to get further (there are other problems).

Anyways, here's a shorter way to do this:

if openssl s_client -connect google.com:443 2> /dev/null < /dev/null |
openssl x509 -checkend $((60*60*24*7)) -noout -in /dev/stdin
then
echo "The certificate is good."
else
echo "The certificate expires within a week."
fi

OpenSSL hanging when trying to encrypt

You're missing an -in in the first half of the command, which is subsequently trying to read data from standard input (and thus hanging).

The correct command line should be

openssl smime -sign -signer C:\Users\MyName\Desktop\OpenSSLTest\my-pubcert.pem -inkey 
C:\Users\MyName\Desktop\OpenSSLTest\my-prvkey.pem -outform der -nodetach -binary
-in C:\Users\MyName\Desktop\OpenSSLTest\DataToEncrypt.txt | openssl smime -encrypt -des3
-binary -outform pem C:\Users\MyName\Desktop\OpenSSLTest\paypal_cert.pem

Notice the addition of -in to line 3.

Then DataToEncrypt.txt will be correctly read as an input file.



Related Topics



Leave a reply



Submit