Winsock IRC Connection with SSL - Looking for some guidance

Windows specific forum
User avatar
bgeraghty
User
User
Posts: 52
Joined: Wed Apr 02, 2014 12:45 am
Location: irc.ibotched.it:+6697
Contact:

Winsock IRC Connection with SSL - Looking for some guidance

Post by bgeraghty »

Greetings,

It's getting to be that cold time of year again, and I'm looking to expand on an old project of mine for fun. Originally, I had written an IRC Client using PureBasic's network libraries and supplemented the SSL functionality by including the cryptlib libraries that can be found at http://www.coastrd.com/download , but I ended up re-writing the application, and found more efficiency in using Winsock 2.2 for my networking needs.

I am now hoping to once again include SSL connectivity in this project, while maintaining use of the Winsock library. After some searching, I'm having a hard time finding a real nuts-and-bolts example of this on a very basic scale, such as what is necessary to connect and send/recv text to an IRC server. What would the best course of action be to accomplish something like this?
SolveMyIssue_() - No QuickHelp available.
User avatar
Keya
Addict
Addict
Posts: 1891
Joined: Thu Jun 04, 2015 7:10 am

Re: Winsock IRC Connection with SSL - Looking for some guida

Post by Keya »

bgeraghty wrote:such as what is necessary to connect and send/recv text to an IRC server. What would the best course of action be to accomplish something like this?
i'd just use a packet-sniffer like the freeware Wireshark and watch what the irc client and server say to each other :) it's a very simple text-based protocol as you probably already know, so its really easy to follow in packet logs. One thing that might initially stump you though is that you need to respond to the PING requests, if you dont i think most servers will just ignore you until you return the right PONG. It's usually just a number, a timestamp.. just send the same number back and then you're on (you'll observe that in the log, but i remember it initially stumped me as to why the server was ignoring my otherwise valid commands - i just hadn't replied to the ping with my pong)
User avatar
bgeraghty
User
User
Posts: 52
Joined: Wed Apr 02, 2014 12:45 am
Location: irc.ibotched.it:+6697
Contact:

Re: Winsock IRC Connection with SSL - Looking for some guida

Post by bgeraghty »

Keya wrote:
bgeraghty wrote:such as what is necessary to connect and send/recv text to an IRC server. What would the best course of action be to accomplish something like this?
i'd just use a packet-sniffer like the freeware Wireshark and watch what the irc client and server say to each other :) it's a very simple text-based protocol as you probably already know, so its really easy to follow in packet logs. One thing that might initially stump you though is that you need to respond to the PING requests, if you dont i think most servers will just ignore you until you return the right PONG. It's usually just a number, a timestamp.. just send the same number back and then you're on (you'll observe that in the log, but i remember it initially stumped me as to why the server was ignoring my otherwise valid commands - i just hadn't replied to the ping with my pong)
Sorry, I may have been unclear in my original post. I have already handled all of the IRC protocol-related stuff (RFC 2812), using Winsock2 for the network connection. What I am asking is for a (very) basic example of Winsock2 being used with SSL to connect to an SSL-based IRC server.
SolveMyIssue_() - No QuickHelp available.
User avatar
bgeraghty
User
User
Posts: 52
Joined: Wed Apr 02, 2014 12:45 am
Location: irc.ibotched.it:+6697
Contact:

Re: Winsock IRC Connection with SSL - Looking for some guida

Post by bgeraghty »

I have put the code as it is right now, on GitHub: https://github.com/CGDN/AFK-IRC-Framework (See IRC_Netwk.pbi and SSL_Library.pb)

I have opted to use the cryptlib DLL (for now) to be able to make SSL connections with this program, however I would eventually like to move to hand-written code for this simple text-based connection over SSL. If anyone has a cleaner solution for PureBasic SSL Sockets, please feel free to share it. My searching and research has still yielded no tangible results.

Thanks,

Bryan
SolveMyIssue_() - No QuickHelp available.
User avatar
bgeraghty
User
User
Posts: 52
Joined: Wed Apr 02, 2014 12:45 am
Location: irc.ibotched.it:+6697
Contact:

Re: Winsock IRC Connection with SSL - Looking for some guida

Post by bgeraghty »

Another one of the reasons I'd like to seek out some example code, rather than use cryptLib here, is that it seems the static library (dll) does not accept self-signed certificates. In my use-case I don't care about this and would like to be able to omit this step of cert validation.
SolveMyIssue_() - No QuickHelp available.
Post Reply