I noticed some problems between installing OpenSSL on Windows XP Professional and Windows 7 Professional. For both OSs, I downloaded the Win32 OpenSSL v1.0.0d
and Visual C++ 2008
Redistributables binaries from the Shining Light Productions website. Both installed with no problems on both machines. However, on the Windows 7 machine, I encountered the following problems using the OpenSSL exe and API:
From the MS-DOS command prompt, I tried to create a root CA with
openssl x509 -req -in rootreq.pem -sha1 -e开发者_开发技巧xtensions v3_ca -signkey rootkey.pem -out rootcert.pem
but was given the following error unable to write random state
. Windows XP worked fine.
- I compiled a simple SSL web server using the OpenSSL API, but when I try to connect using
openssl s_client -connect 127.0.0.1:16001
I get the following response
Loading 'screen' into random state - done
connect: No such file or directory
connect:errno=0
Once again, Windows XP returned a better response. If you look at my attached code, it appears that the second BIO_do_accept never gets called.
Does anyone know what the problem may be ? Are there extra steps that I need to take when installing on Windows 7?
FYI - I also tried installing the 64 bit binaries on Windows 7 as well, but I got the same results. I really need to get this up and running on my Windows 7 machine, so any help is appreciated.
/////////////////// Code ///////////////////////////////////
// Simple OpenSSL Webserver
// Compiler : MSVS 2010 Professional
// Language: C / C++
int main(int argc, char *argv[])
{
BIO *acc, *client;
SSL *ssl;
SSL_CTX *ctx;
THREAD_TYPE tid;
init_OpenSSL( );
seed_prng( );
ctx = setup_server_ctx( );
acc = BIO_new_accept(PORT);
printf ("BIO_new_accept\n");
if (!acc)
int_error("Error creating server socket");
if (BIO_do_accept(acc) <= 0)
int_error("Error binding server socket");
printf ("BIO_do_accept\n");
for (;;)
{
if (BIO_do_accept(acc) <= 0)
int_error("Error accepting connection");
printf ("BIO_do_accept2\n");
client = BIO_pop(acc);
printf ("BIO_pop\n");
if (!(ssl = SSL_new(ctx)))
int_error("Error creating SSL context");
printf ("SSL_new\n");
SSL_set_bio(ssl, client, client);
printf ("SSL_set_bio\n");
THREAD_CREATE(tid, (void *)server_thread, ssl);
}
SSL_CTX_free(ctx);
BIO_free(acc);
return 0;
}
I have success using the MinGW-w64 platform to build my OpenSSL applications (both for x86 and x64 Windows), and I also had some issues with the Shining Light binaries.
It is quite easy to set up, there are some instructions and a sample application at http://www.blogcompiler.com/2011/12/21/openssl-for-windows/
Thanks for the answer. I discovered that the best way was to compile everything myself. I found a good tutorial at the following site - http://www.askyb.com/windows/compiling-and-installing-openssl-for-32-bit-windows/
when you click on command prompt right click and click run as administrator that should clear up your issue
精彩评论