argumentum

Help on SSL TCP/IP

13 posts in this topic

I find a strong limitation with TCP, and that is that is plain text. I need to encapsulate it and with the standard UDFs in AutoIt is slow and cumbersome.
So, I've decided to write a DLL to take care of the TCP encrypted communication and pass to AutoIt the decrypted data ( what I wrongly called "plain text" )
that in the end, is gonna turn into a HTTPS server I believe.

Now, I only know AutoIt as a language and I'd need to learn C#, C++ or the like to get it done. 

I need help in the sense that I don't know how to face this project given my lack of experience.
Should I use OpenSSL libraries ?,  visual studio internal libraries?, no clue.

I welcome all opinions and personal experience, positive or negative to this project.
Snippets of code in any language and/or open projects ( I'll have to learn other languages anyway ) are most welcome.

As always, my inclination is to make the DLL portable ( no .NET ) placed in the path of the app.

Thanks for your time and wish me luck

Share this post


Link to post
Share on other sites



@Trong , my question is more along the line of what approach to take to build the DLL ( taking in consideration it's accompanying UDF ), from experienced C++ ppl due to my inexperience. Maybe to take care of X or something, maybe it will not work with AutoIt due to the lack of idispatch or something. No clue. So before I start, I'd like to have some input. If no guidance is provided for this, then, I'll be a painful attempt learning experience.

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Hi argumentum,

the (free) Boost C++ template library offers the possiblity of an encryption layer on top of TCP. Never implemented it myself though.

Edited by RTFC
1 person likes this

Share this post


Link to post
Share on other sites

If you want to make HTTP/S server in AutoIt then you don't need any third party dll. Just use HTTP Server API, that's part of standard Windows installation since almost forever.
If you want to make you own dll wrapping it then you have working server example on msdn in form of simple executable. If you don't know how, I can compile it for you to test it so that you can see how simple (and small) it is.

However, I would use it directly without any dll wrapping.


♡♡♡

.

eMyvnE

Share this post


Link to post
Share on other sites

the (free) Boost C++ template library offers the possiblity of an encryption layer on top of TCP. Never implemented it myself though.

That was one of the libraries that called my attention, but if WebSockets can be used on the HTTPS server @trancexx tells me can be done, then,

If you want to make HTTP/S server in AutoIt then you don't need any third party dll. Just use HTTP Server API,

I'd like a clue on how to go about it. I'd use this code to make all communication between scripts and even a SQLite server, now, 

If you want to make you own dll wrapping it then you have working server example on msdn in form of simple executable. If you don't know how, I can compile it for you to test it so that you can see how simple (and small) it is.

However, I would use it directly without any dll wrapping.

if a wrapper would make it easier or more stable, then, I'd wrap it up, else, ... .
In either case I'd need help. So I would appreciate guidance in both approaches.

@trancexx let me know how you feel about my view and what I should be doing on my own, I don't want to be abusive.

Thanks for your time @RTFC and @trancexx .

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

I'd like a clue on how to go about it. I'd use this code to make all communication between scripts and even a SQLite server, now, 

 

if a wrapper would make it easier or more stable, then, I'd wrap it up, else, ... .
In either case I'd need help. So I would appreciate guidance in both approaches.

@trancexx let me know how you feel about my view and what I should be doing on my own, I don't want to be abusive.

Thanks for your time @RTFC and @trancexx .

HTTP Server API documentation is at https://msdn.microsoft.com/en-us/library/windows/desktop/aa364510(v=vs.85).aspx

Sample application is at https://msdn.microsoft.com/en-us/library/windows/desktop/aa364640(v=vs.85).aspx

That's about all you need.

I'm not sure how advanced you are, but to test yourself try compiling the code from the sample. If you fail then you have no business working with C/C++, or making DLLs. In that case try writing UDF for HTTP Server API (wrap only those few functions from the sample code) and use them to make server. This is the server that I just compiled for you from the sample:  HTTPServer.zip

It's tested and it works exactly as expected. You should run it as administrator

HTTPServer.exe https://your_ip:443/whatever

...and it'll be available from your browser on address

https://your_ip/whatever

 

Edited by trancexx
1 person likes this

♡♡♡

.

eMyvnE

Share this post


Link to post
Share on other sites

HTTPServer.exe https://your_ip:443/whatever
...and it'll be available from your browser on address
https://your_ip/whatever

"Hey! You hit the server",
thanks a million !, now, this works as HTTP and not as HTTPS, and I'm looking at SSL'ing ( so to say  ) the communication.
My extensive knowledge in C++ is close to null ( and I'd say even less), yet, I want it ( the SSLing ) of the TCP.

All I can offer is willingness and .... yep, that's it. I'm not totally clueless, but might as well.
In any case, any guidance towards my goal still welcomed ( I mean, I need it ) :)

Share this post


Link to post
Share on other sites

"Hey! You hit the server",
thanks a million !, now, this works as HTTP and not as HTTPS, and I'm looking at SSL'ing ( so to say  ) the communication.
My extensive knowledge in C++ is close to null ( and I'd say even less), yet, I want it ( the SSLing ) of the TCP.

All I can offer is willingness and .... yep, that's it. I'm not totally clueless, but might as well.
In any case, any guidance towards my goal still welcomed ( I mean, I need it ) :)

It works as HTTPS for sure. I just started it on my comp if you want to try. Here (until my ip changes):

https://88.207.61.216/test

You will see certificate error because there is no certificate installed for that ip.

You can access it without that warning while I'm letting it run by using this address:

https://trancexx.paratus.hr/test

I have installed certificate for that address.


♡♡♡

.

eMyvnE

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

It works as HTTPS for sure. I just started it on my comp if you want to try. Here (until my ip changes) ...
...
I have installed certificate for that address.

Do take the server down, I see that is true. Don't understand how. "This certificate is OK.".
While I tried locally it did not work. So, next up is, how do I install a certificate in my PC to work with WinHTTP.
Still don't understand how it works. I don't see anything in the code to show the use of SSL.
Where can I read more about this. Or is something that's undocumented ?

Edit: "SSL server certificate verification is enabled by default in WinHTTP 5.1" at
https://msdn.microsoft.com/en-us/library/windows/desktop/aa384086(v=vs.85).aspx
Thanks @trancexx

Edited by argumentum

Share this post


Link to post
Share on other sites

ok, I've got more than I expected.

@Trong , I disregarded your link too promptly without paying due attention, it uses the Boost C++ libraries @RTFC pointed out.

@trancexx , I've found 89 samples for Windows Web Services at code.msdn.

Now all I have to do is learn C++ and figure out what is the best way to go about it. I'll have it done in a week or 2
years, no big deal. :D 

I wrote this to say thanks, so, thank you all :) 

Share this post


Link to post
Share on other sites

You're welcome, argumentum, and you're very lucky to have trancexx as your guiding star. Re. getting your feet wet with C++, you may find this thread of interest. Best of luck.

RT

1 person likes this

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now