我注意到在 Windows XP Professional 和 Windows 7 Professional 上安装 OpenSSL 之间存在一些问题。对于这两个操作系统,我从 Shining Light Productions 网站下载了 Win32 OpenSSL v1.0.0d
和 Visual C++ 2008
Redistributables 二进制文件。两台机器上都安装没有问题。然而,在Windows 7机器上,我使用OpenSSL exe和API遇到了以下问题:
在 MS-DOS 命令提示符下,我尝试使用以下命令创建根 CA
openssl x509 -req -in rootreq.pem -sha1 -extensions v3_ca -signkey rootkey.pem -out rootcert.pem
但出现以下错误无法写入随机状态
。 Windows XP 运行良好。
- 我使用 OpenSSL API 编译了一个简单的 SSL Web 服务器,但是当我尝试使用以下方式进行连接时
openssl s_client -connect 127.0.0.1:16001
我收到以下回复
Loading 'screen' into random state - done
connect: No such file or directory
connect:errno=0
Windows XP 再次给出了更好的响应。如果您查看我附加的代码,似乎第二个 BIO_do_accept 永远不会被调用。
有谁知道可能是什么问题吗?在 Windows 7 上安装时是否需要执行额外的步骤?
仅供引用 - 我也尝试在 Windows 7 上安装 64 位二进制文件,但得到了相同的结果。我确实需要在我的 Windows 7 计算机上安装并运行它,因此非常感谢您的帮助。
/////////////////// 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;
}
最佳答案
我成功地使用 MinGW-w64 平台构建了我的 OpenSSL 应用程序(适用于 x86 和 x64 Windows),并且我在使用 Shining Light 二进制文件时也遇到了一些问题。
设置非常简单,http://www.blogcompiler.com/2011/12/21/openssl-for-windows/ 有一些说明和示例应用程序
关于windows-7 - 在 Windows 7 中使用 OpenSSL 的问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6527398/