【问题标题】:Problems Using OpenSSL in Windows 7在 Windows 7 中使用 OpenSSL 的问题
【发布时间】:2011-06-29 21:20:46
【问题描述】:

我注意到在 Windows XP Professional 和 Windows 7 Professional 上安装 OpenSSL 之间存在一些问题。对于这两个操作系统,我从 Shining Light Productions 网站下载了 Win32 OpenSSL v1.0.0dVisual 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
    

但收到以下错误unable to write random state。 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;
}

【问题讨论】:

  • 你是说第一次调用 BIO_do_accept() 会导致错误?

标签: windows-7 openssl


【解决方案1】:

我成功地使用 MinGW-w64 平台构建了我的 OpenSSL 应用程序(适用于 x86 和 x64 Windows),但我在使用 Shining Light 二进制文件时也遇到了一些问题。

设置非常简单,http://www.blogcompiler.com/2011/12/21/openssl-for-windows/ 有一些说明和示例应用程序

【讨论】:

  • 感谢您的回答。我发现最好的方法是自己编译所有内容。我在以下站点找到了一个很好的教程 - askyb.com/windows/…
【解决方案2】:

感谢您的回答。我发现最好的方法是自己编译所有内容。我在以下站点找到了一个很好的教程 - http://www.askyb.com/windows/compiling-and-installing-openssl-for-32-bit-windows/

【讨论】:

    【解决方案3】:

    当您单击命令提示符时,右键单击并单击以管理员身份运行,这应该可以解决您的问题

    【讨论】:

      猜你喜欢
      • 2018-04-16
      • 1970-01-01
      • 1970-01-01
      • 2012-04-24
      • 1970-01-01
      • 1970-01-01
      • 2018-12-04
      • 2011-07-02
      • 2015-08-13
      相关资源
      最近更新 更多