Re: Encrypted Data over Sockets

2022-07-09 Thread Mark Wieder via use-livecode

On 7/8/22 19:47, Bob Sneidar via use-livecode wrote:

Okay apparently base64Encode/Decode is my friend. I have this working now 
without encryption. I will re-enable encryption and see if that works.


Base64 encoding will do the trick but at the expense of making your data 
strings twice as long as the binary equivalents.


--
 Mark Wieder
 ahsoftw...@gmail.com

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Encrypted Data over Sockets

2022-07-08 Thread Bob Sneidar via use-livecode
Hi all. 

Thanks for putting up with me. I finally got it all to work using 
base64Encode/Decode on the encrypted string before sending it with a delimiter 
appended. Same thing coming back. 

Thank for all your patience. I almost became a patient myself. 

Bob S


> On Jul 8, 2022, at 19:14 , Bob Sneidar via use-livecode 
>  wrote:
> 
> It looks after the agent receives it generally like how it looked after I 
> encoded the array but before I sent it. Obviously it's not the same. 
> Something is corrupting it over the wire. I am not even using encryption now, 
> just sending the encoded array data and a delimiter. When it decodes on the 
> other end now, arrayDecode fails. 
> 
> I guess the question I *should* be asking is, how do I encode binary data to 
> be sent over the wire so that it doesn't become corrupted? 
> 
> Bob S
> 
> 
>> On Jul 8, 2022, at 17:48 , Mark Wieder via use-livecode 
>>  wrote:
>> 
>> On 7/8/22 16: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.
>> 
>> Not sure what "looks like" an encoded array should mean.
>> When you encode an array you get binary data. You can't treat it like text.
>> 
>> -- 
>> Mark Wieder
>> ahsoftw...@gmail.com
>> 
>> ___
>> use-livecode mailing list
>> use-livecode@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@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@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Encrypted Data over Sockets

2022-07-08 Thread Bob Sneidar via use-livecode
Okay apparently base64Encode/Decode is my friend. I have this working now 
without encryption. I will re-enable encryption and see if that works. 

Bob S


> On Jul 8, 2022, at 19:14 , Bob Sneidar via use-livecode 
>  wrote:
> 
> It looks after the agent receives it generally like how it looked after I 
> encoded the array but before I sent it. Obviously it's not the same. 
> Something is corrupting it over the wire. I am not even using encryption now, 
> just sending the encoded array data and a delimiter. When it decodes on the 
> other end now, arrayDecode fails. 
> 
> I guess the question I *should* be asking is, how do I encode binary data to 
> be sent over the wire so that it doesn't become corrupted? 
> 
> Bob S
> 
> 
>> On Jul 8, 2022, at 17:48 , Mark Wieder via use-livecode 
>>  wrote:
>> 
>> On 7/8/22 16: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.
>> 
>> Not sure what "looks like" an encoded array should mean.
>> When you encode an array you get binary data. You can't treat it like text.
>> 
>> -- 
>> Mark Wieder
>> ahsoftw...@gmail.com
>> 
>> ___
>> use-livecode mailing list
>> use-livecode@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@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@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Encrypted Data over Sockets

2022-07-08 Thread Bob Sneidar via use-livecode
It looks after the agent receives it generally like how it looked after I 
encoded the array but before I sent it. Obviously it's not the same. Something 
is corrupting it over the wire. I am not even using encryption now, just 
sending the encoded array data and a delimiter. When it decodes on the other 
end now, arrayDecode fails. 

I guess the question I *should* be asking is, how do I encode binary data to be 
sent over the wire so that it doesn't become corrupted? 

Bob S


> On Jul 8, 2022, at 17:48 , Mark Wieder via use-livecode 
>  wrote:
> 
> On 7/8/22 16: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.
> 
> Not sure what "looks like" an encoded array should mean.
> When you encode an array you get binary data. You can't treat it like text.
> 
> -- 
> Mark Wieder
> ahsoftw...@gmail.com
> 
> ___
> use-livecode mailing list
> use-livecode@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@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Encrypted Data over Sockets

2022-07-08 Thread Mark Wieder via use-livecode

On 7/8/22 17:47, Alex Tweedly via use-livecode wrote:
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.


Yeah.
What he said.

--
 Mark Wieder
 ahsoftw...@gmail.com

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Encrypted Data over Sockets

2022-07-08 Thread Mark Wieder via use-livecode

On 7/8/22 16: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.


Not sure what "looks like" an encoded array should mean.
When you encode an array you get binary data. You can't treat it like text.

--
 Mark Wieder
 ahsoftw...@gmail.com

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Encrypted Data over Sockets

2022-07-08 Thread Alex Tweedly via use-livecode
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 
 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
ahsoftw...@gmail.com

___
use-livecode mailing list
use-livecode@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@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@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Encrypted Data over Sockets

2022-07-08 Thread Bob Sneidar via use-livecode
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 
>  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
> ahsoftw...@gmail.com
> 
> ___
> use-livecode mailing list
> use-livecode@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@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Encrypted Data over Sockets

2022-07-08 Thread Mark Wieder via use-livecode

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
 ahsoftw...@gmail.com

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode