问题描述
您好,
我开发了一个客户端和服务器,它使用OpenSSL通过TCP使用TLS进行通信,并且运行良好。
但我需要通过Namedpipe进行沟通,并且有一个问题:
当我创建一个namedpipe时,我打电话给:
Hello,
I developed a client and server that use the OpenSSL to communicate using TLS via TCP, and it is working very well.
But I need to communicate via Namedpipe, and there is the question:
When I create a namedpipe, I call:
HANDLE hPipe = CreateNamedPipe(...);
ConnectNamedPipe(hPipe, NULL);
连接Namedpipe后,我需要打电话:
After the Namedpipe is connected, I need call:
int SSL_set_fd(SSL *ssl, int fd);
正如我们所看到的,hPipe是一个HANDLE,但我需要将此HANDLE转换为int。所以我尝试使用下面的方法获得一个int然后调用SSL_set_fd(ssl,fd):
As we can see, the "hPipe" is a HANDLE, but I need convert this HANDLE to int. So I tried to use the below to get a "int" then call SSL_set_fd(ssl, fd):
int fd = _open_osfhandle(reinterpret_cast<intptr_t>(hPipe), 0);
_open_osfhandle()的返回值为3,但当我尝试调用SSL_accept()时,OpenSSL不接受。
我做错了吗?
还有其他方法可以将OpenSSL与Namedpipe一起使用吗?
注意:我正在使用Microsoft Visual Studio,C ++。
谢谢。
The return of _open_osfhandle() will be "3", but OpenSSL isn't accepting when I try call "SSL_accept()".
Am I doing something wrong?
Is there other way to use OpenSSL with Namedpipe?
Note: I'm using the Microsoft Visual Studio, C++.
Thank you.
推荐答案
这篇关于Namedpipe和OpenSSL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!