TLS socket connection in Xbase 1.9

This forum is for general support of Xbase++
Post Reply
Message
Author
User avatar
SlavkoDam
Posts: 111
Joined: Wed Apr 27, 2022 10:12 am
Location: Negotin, Serbia
Contact:

TLS socket connection in Xbase 1.9

#1 Post by SlavkoDam »

Hello,
In Xbase 2.0 socket functions work for both non-TLS and TLS connections. They work fine for any Internet protocol.
In Xbase 1.9 socket functions work fine only for non-TLS connections. TLS connection is created successfully, but on ClientHello message, TLS server always returns alert error 50, which is decode error.
Also, in Xbase 2.0 socket descriptors have 8 digits and in Xbase 1.9 they have 3-4 digits.
I use the same socket functions both in Xbase 1.9 and Xbase 2.0.
Does anybody knows what is the difference, and what I did wrong or miss?

Thanks.
Best regards,

Slavoljub Damnjanovic
SD-SoftDesign, Alaska Software Technology Partner
https://www.sd-softdesign.com
https://www.sd-softdesign.rs

User avatar
Tom
Posts: 1205
Joined: Thu Jan 28, 2010 12:59 am
Location: Berlin, Germany

Re: TLS socket connection in Xbase 1.9

#2 Post by Tom »

You will need Xb2.Net (prof) in a later version to do this - or switch to 2.0. Xbase++ 1.9 doesn't support SSL/TLS.
Best regards,
Tom

"Did I offend you?"
"No."
"Okay, give me a second chance."

User avatar
SlavkoDam
Posts: 111
Joined: Wed Apr 27, 2022 10:12 am
Location: Negotin, Serbia
Contact:

Re: TLS socket connection in Xbase 1.9

#3 Post by SlavkoDam »

Hi Tom,
Yes, I know that Xbase 1.9 don't support TLS. In order to overcome that lack for Xbase 1.9 users, I developed my own implementation of WinSock2, and it works o.k. but only for non-TLS as in Xbase 1.9. The point is that the base socket should be set to security state to work for TLS. There are several methods to do that. I tried the basic one, but without results.
Xb2.Net uses OpenSSL for TLS connection and communication. I don't need that because I have developed my own TLS implementation, and it works fine in Xbase 2.0, because in it the sockets are secured.
I have to try some other options for securing sockets.

Regards
Best regards,

Slavoljub Damnjanovic
SD-SoftDesign, Alaska Software Technology Partner
https://www.sd-softdesign.com
https://www.sd-softdesign.rs

User avatar
SlavkoDam
Posts: 111
Joined: Wed Apr 27, 2022 10:12 am
Location: Negotin, Serbia
Contact:

Re: TLS socket connection in Xbase 1.9

#4 Post by SlavkoDam »

The problem is solved. I was not the problem in socket, but in Xbase++ function RandomKey() which return empty value in 1.9. I created my own function for that purpose in C using WinApi, and now TLS client works fine. All Internet clients in Xbase++ 1.9 now support TLS connection.
Best regards,

Slavoljub Damnjanovic
SD-SoftDesign, Alaska Software Technology Partner
https://www.sd-softdesign.com
https://www.sd-softdesign.rs

User avatar
rdonnay
Site Admin
Posts: 4774
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: TLS socket connection in Xbase 1.9

#5 Post by rdonnay »

That is good information for 1.9 users.
It probably could have been written in Xbase++ too, for those 1.9 users who can't program C.
The eXpress train is coming - and it has more cars.

User avatar
SlavkoDam
Posts: 111
Joined: Wed Apr 27, 2022 10:12 am
Location: Negotin, Serbia
Contact:

Re: TLS socket connection in Xbase 1.9

#6 Post by SlavkoDam »

Random key generation can be simulated in Xbase++ code with STRTRAN(UUIDTOCHAR(UUIDCREATE()), "-", ""), but this returns key of length 16. For larger keys the same code can be repeated in a loop, concatenated the results, and SUBSTR() it to the right length.
Best regards,

Slavoljub Damnjanovic
SD-SoftDesign, Alaska Software Technology Partner
https://www.sd-softdesign.com
https://www.sd-softdesign.rs

User avatar
Auge_Ohr
Posts: 1422
Joined: Wed Feb 24, 2010 3:44 pm

Re: TLS socket connection in Xbase 1.9

#7 Post by Auge_Ohr »

hi,

"how" have you integrate "C"-Code to Xbase++ :?:
can you please post some "C"-Code Sample for Xbase++

p.s. under harbour i can make COM DLL so i can use it as ActiveX
greetings by OHR
Jimmy

User avatar
SlavkoDam
Posts: 111
Joined: Wed Apr 27, 2022 10:12 am
Location: Negotin, Serbia
Contact:

Re: TLS socket connection in Xbase 1.9

#8 Post by SlavkoDam »

Hi,
I use Xbase++ C-API extension, which is part of Xbase++ package. It works great and have many capabilities, especially for sending parameters to C function and retrieving results from it. You can create a C DLL file and link it with your app, or just a C object files and link it with Xbase++ object files. I personally create a C DLL file, don't like to mix different code files.
There is one simple example in Xbase++ C-API documentation. It shows how to make both version of integration. I tested it and it works fine.
Best regards,

Slavoljub Damnjanovic
SD-SoftDesign, Alaska Software Technology Partner
https://www.sd-softdesign.com
https://www.sd-softdesign.rs

Post Reply