www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Example of Windows SSL with Secure Channel?

reply Anonymouse <zorael gmail.com> writes:
Does anyone have an example snippet code connecting to, reading 
from and writing to a server using SSL under Windows with Secure 
Channel? Something in a personal project you wouldn't mind 
sharing a part of to let me dissect?

My project (IRC bot) supports connecting to a server using SSL, 
for which I'm currently using OpenSSL with 
[requests.ssl_adapter](https://github.com/ikod/dlang-requests/blob/master/source/requ
sts/ssl_adapter.d). It's a simple thing that just sets up an SSL context,
connects using the normal `Socket.connect`, establishes SSL, and then uses
OpenSSL functions to read and write instead of Phobos' `Socket.{receive,send}`.
It works, but unlike in Linux where OpenSSL is ubiquitous, on Windows you have
to manually download and install OpenSSL from a third-party site. It still
works, but it's not ideal.

Frustratingly there is no `std.socket.ssl`.

I'm helplessly a Linux creature and I don't know where to start. 
Does anyone have anything I could look at?
Mar 19 2022
next sibling parent a11e99z <black80 bk.ru> writes:
On Saturday, 19 March 2022 at 16:54:03 UTC, Anonymouse wrote:
 Does anyone have an example snippet code connecting to, reading 
 from and writing to a server using SSL under Windows with 
 Secure Channel? Something in a personal project you wouldn't 
 mind sharing a part of to let me dissect?
https://www.amazon.com/Programming-Server-Side-Applications-Microsoft-Windows/dp/0735607532 You can download example for it: SslChat
Mar 20 2022
prev sibling parent reply Marcone <marcone email.com> writes:
I hope one day the creators of the D programming language will 
implement std.socket.ssl ​​in the Phobos library.
Mar 21 2022
parent janrinok <janrinok protonmail.com> writes:
On Monday, 21 March 2022 at 17:30:31 UTC, Marcone wrote:
 I hope one day the creators of the D programming language will 
 implement std.socket.ssl ​​in the Phobos library.
I have to agree. For those just getting to grips with D there are some things in the library that just make using them much more difficult than they ought to be, or altogether impossible.
Mar 27 2022