EldoS | Feel safer!

Software components for data protection, secure storage and transfer

TElSSLClient Buffer management

Also by EldoS: RawDisk
Access locked and protected files in Windows, read and write disks and partitions and more.
#22640
Posted: 11/27/2012 03:57:30
by Xavier Allaume (Basic support level)
Joined: 11/27/2012
Posts: 2

Hello,

I'm trying to add an SSL layer on top of a working Silverlight 5 TCP communication with a proprietary server.

So far, I seem to be able to connect and send data to the server in SSL mode. Problems occur when I try to receive : this server sends me data in real time. I have a "listening thread" that should do:
- read the 8 first bytes of a message
- from there I know the length of the full message
- read the full message

My problem is that I'm well able to get the 8 bytes. They are put in "buffer" in the SecureServerOnReceive (one time 5 bytes, one time 3 bytes), but the SecureServerOnData event handler is never raised.

Do you think it is possible to do it?
How to force the decryption of those 8 bytes?
When does your system decide that it should decrypt what's in SecureServerOnReceive.buffer ?
Did I understand well that inBuffer only represents the socket buffer. So no decrypted data will ever be in it, only encrypted data?

Thank you very much for your help.
#22642
Posted: 11/27/2012 04:15:21
by Vsevolod Ievgiienko (EldoS Corp.)

Thank you for contacting us.

When any data is available for receiving you should call TElSSLClient.DataAvailable(). It will invoke TElSSLClient.OnReceive/OnSend if necessary and will fire TElSSLClient.OnData (if any data was received) that you can use to read decrypted data. TElSSLClient.OnReceive/OnSend operate with raw encrypted data.

For you task you should use some internal buffer where all incoming data should be saved and then your application should parse it to find the length of the full message etc.
#22795
Posted: 12/13/2012 10:13:57
by Xavier Allaume (Basic support level)
Joined: 11/27/2012
Posts: 2

Thanks a lot for your answer. It already helped a lot. Now my code seems working except when I receive very close triggers of TelSSLClient.OnData. I looks like the simple work of copying the buffer isn't done with the first call, and the second call already comes in and create me troubles.

Do you think of any way to serialize the trigger of TelSSLClient.OnData?
#22796
Posted: 12/13/2012 10:20:17
by Vsevolod Ievgiienko (EldoS Corp.)

Its hard to say why this happens without a code samples. Try to use some synchronization mechanism to work with the buffer.
#22798
Posted: 12/13/2012 10:43:09
by Eugene Mayevski (EldoS Corp.)

What buffer copying are you talking about? When OnData is fired, your need to pick the data from the buffer to your storage - after this the buffer is reused and new data is there.

Did you check the samples? We do have them and they do help to understand event-driven processing of data.


Sincerely yours
Eugene Mayevski
Also by EldoS: Rethync
The cross-platform framework that simplifies synchronizing data between mobile and desktop applications and servers and cloud storages

Reply

Statistics

Topic viewed 935 times

Number of guests: 1, registered members: 0, in total hidden: 0




|

Back to top

As of July 15, 2016 EldoS Corporation will operate as a division of /n software inc. For more information, please read the announcement.

Got it!