Encrypted Data over Sockets

Alex Tweedly alex at tweedly.net
Fri Jul 8 20:47:07 EDT 2022


But, an encoded array is STILL binary data. So any issues with "read 
until linefeed" will still exist.

Try sending a header with number of bytes, followed by the bytes.

If you really wanted, you could do:

    write  (the number of bytes in tSocketData) & linefeed to socket tSocket
    write tSocketData & linefeed to socket tSocket

and then when you read,

    read from socket tSocket until linefeed
    put it into tNumBytes
    read from socket tSocket until linefeed
    put it into tData

and compare tNumbytes with the number of bytes in tData

Or, just do

    read tnumbytes form socket tSocket

Alex.

On 09/07/2022 00:49, Bob Sneidar via use-livecode wrote:
> Well I disabled encryption alltogether, sending and receiving an encoded array instead. Upon trying to decode I still get an error, and looking at what I get back, it LOOKS like an encoded array. They is just something wrong with the data. Curiously, if I just send and receive plain text it works every time.
>
> Bob S
>
>
>> On Jul 8, 2022, at 16:35 , Mark Wieder via use-livecode <use-livecode at lists.runrev.com> wrote:
>>
>> On 7/8/22 16:14, Bob Sneidar via use-livecode wrote:
>>
>>> My suspicion is that the hash contains a linefeed (sometimes). So the question I have is, what character is GUARANTEED to NOT be in an aes256 hash?
>> Not a valid question.
>>
>> If you really need to send binary data over a socket connection, start by sending a header that contains the data length. Extract that and then read that many bytes.
>>
>> -- 
>> Mark Wieder
>> ahsoftware at gmail.com
>>
>> _______________________________________________
>> use-livecode mailing list
>> use-livecode at lists.runrev.com
>> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode
>
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode



More information about the use-livecode mailing list