Ah ok so just checked the docs on the array encode version added in LC 7 and 
found:
```
If present, and >= "7.0" then the array is encoded in such a way as to preserve 
unicode in keys and values, as well as NUL chars in keys and values
```

So try `arrayEncode(array, “7.0")`

> On 19 Feb 2025, at 10:18 AM, Bob Sneidar via use-livecode 
> <use-livecode@lists.runrev.com> wrote:
> 
> The structure looks like the following:
> 
> Sly File Agent API
>   Structure of payload sent
> 
>      [0] 
>         [profile] <selected location profile>
>      [n] 
>         [data] <encrypted binary data of file>
>         [datemodified] <file system date modified>
>         [extpath] <file path suffix unique to each file>
>         [filecategory] <used by sql files database when data is returned>
>         [fileid] <used by sql files database when data is returned>
>         [filename] <name of file to be saved to disk. Also used by sql files 
> database when data is returned>
>         [filepath] <root path to save file to. extpath should be appended to 
> this>
>         [operation] <savefile, retrievefile, movefile, deletefile>
>         [saveaction] <new, newversion, overwrite unique to each file>
>         [version] <new version number also used by sql files database when 
> data is returned>
>      [n+1]…
> 
> The problem is definitely the binary data stored in the [n] [“data”] key. If 
> I immediately decrypt the data in the key on the MacOS the data is correct. 
> But when I decrypt the exact same data on the Windows OS I get a bad decrypt 
> error. 
> 
> So to be perfectly clear, I create the above array, I iterate through each 
> key from 1 to n, encrypting and overwriting the information in the [“data”] 
> key. I then arrayEncode the entire array, then base64encode everythign before 
> transmitting it over the wire. 
> 
> I reverse the process on the receiving side. It seems to work if I send 
> non-binary data in the [“data”] key but if the data is binary, it fails. I do 
> not think arrayEncode / decode likes to work with binary data. 
> 
> Bob S
> 
> 
>> On Feb 18, 2025, at 2:45 PM, Monte Goulding via use-livecode 
>> <use-livecode@lists.runrev.com> wrote:
>> 
>> 
>> 
>>> On 19 Feb 2025, at 9:39 AM, Bob Sneidar via use-livecode 
>>> <use-livecode@lists.runrev.com> wrote:
>>> 
>>> but one key is the binary file data of a file that has been encrypted using 
>>> LC’s built in library.
>> 
>> Are you using this as the key or element value? I think keys are always 
>> treated as text. It has been quite one time since I’ve been poking the 
>> engine in a meaningful way though so I might be forgetting that.
>> 
>> Cheers
>> 
>> Monte
>> _______________________________________________
>> 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

Reply via email to