What exactly is this data format or type? reddit / selfhosted ---------------------------------------------------------------------- AmountOk3836 · 2023-12-17 08:27 I have been using Element Note for a while and they have a proprietary export format of .element. I wanted to make a viewer for it so I can self host notes and backup on a web server but I can’t figure out what exactly the data type stored in the json is. What I have figured out so far: On export, the .element file is basically just a zipped folder. Inside the folder will be a manifest.json file which lists presets within the app such as page background and size etc. The other files will be page1.json etc and they contain the actual handwritten strokes, here is an example: {"paper":{"size":[595,842],"type":"grid","spacing":2},"page":{"bru shes":[{"t":"monoline","c":"#000000","w":1.5},{"t":"monoline","c":"#fd 1400","w":1.5}],"overlays":[],"strokes":[{"v":1,"p":"","b":0,"pv":1,"i d":"DCBC1745-59CC-4845-8A14-1EA51A4552D9","vid":"5A116878-B510-4CFD-AC 51-F4CEC1EE15C0"},{"v":1,"vid":"5CF995A3-BE40-4769-B893- 53491B14B001","pv":1,"id":"2891315F-15ED-484A-9B3D- BC7B537B37BD","p":"","b":0},{"v":1,"pv":1,"p":"","b":0,"id":"D0EC9C27- AD2A-4D5E-A21A-023334BBCBC4","vid":"23691BE6-CF01-47A2-A29A- B8111921F67B"},{"t":[1,0,0,1,-19.9760191846496,- 1.4268585133564855],"vid":"C3380E9E-7B99-4316-9360- CDD3423846AD","pv":1,"b":0,"v":2,"id":"607DB0A2-182D-4023-9F64- CAABF8E81DCF","p":"\/HiKQmR8BUIAAAAAAAAAAG7Fij4Ab6Y\/A97MPnJzk0GubYpCd ysFQgAAAAAAAAAAbsWKPgBvpj8D3sw+cnOTQdZfikKA0wRCAAAAAAAAAABuxYo+AG+mPwP ezD5yc5NBrk+KQgZtBEIAAAAAAAAAAG7Fij4Ab6Y\/A97MPnJzk0HyQIpCZwEEQgAAAAAA AAAAbsWKPgBvpj8D3sw+cnOTQUQvikIplwNCAAAAAAAAAAC++J0+AG+mPwPezD5ATapBJR +KQhsoA0IAAAAAAAAAAL74nT4Ab6Y\/kfzMPkBNqkHoDIpCqbQCQgAAAAAAAAAAxHOvPgB vpj+2f80++w\/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iKQgAAAAAAAAAAUmkPP4CPoD+GYNU+aYGGQhBw eEL2AopCAAAAAAAAAADDweY+gI+gP4Zg1T4mu3RCBXd4QniliUIAAAAAAAAAAOHNNz6Aj6 A\/hmDVPvNcHUJ0gnhCjzGJQgAAAAAAAAAAs7vtPYCPoD+GYNU+TCAwQvWNeEL5xIhCAAA AAAAAAACzu+09gI+gP4Zg1T5MIDBCHJV4QnJ9iEIAAAAAAAAAALO77T2Aj6A\/hmDVPkwg MEI="} I’m not able to figure out how to display the long list of random characters after the “p:”. I tried Base64 decode with no luck, it’s not a png either. I have a feeling it could also be proprietary to the app but I hope it isn’t. Any idea? ---------------------------------------------------------------------- wolfbyknight · 2023-12-17 08:44 I'm on my mobile so I can't easily test but did you remove all the \ from the string before you tried to decode it? Because it's being stored in a string the / needs to be escaped so it doesn't accidentally push things like /n as a line feed. If you haven't, replace all the \/ with / and try running your base64 decode again. I suspect what you're going to wind up with is still a binary format. What the decoded binary format is however, hard to say. ---------------------------------------------------------------------- AmountOk3836 · 2023-12-17 11:52 Hmm I tried and base64 decode lists it as being from UTF-16 character set. Unfortunately the decoded output also makes no sense: Input: HiKQmR8BUIAAAAAAAAAAG7Fij4Ab6Y Output: Ḣ邙ἁ傀���녢辀ᯩ ---------------------------------------------------------------------- freedomlinux · 2023-12-17 11:57 Excellent point. The "/" is part of the base64 character set, but "\" is not. My suspicion is the "\" are added as an escape code for the JSON format. Removing the "\" entirely resulted in a valid base64 string that was ... a big binary blob. Yeah, I don't think this is going to be fun without input from the app developer. ---------------------------------------------------------------------- wolfbyknight · 2023-12-17 21:18 Apologies, I didn't realise my original comment stripped out the \\ when I suggested replacement of `\\/` to `/. Hopefully it was still clear from the first part of the message. ---------------------------------------------------------------------- wolfbyknight · 2023-12-17 21:28 Apologies, I didn't realise my original comment stripped out the \\ when I suggested replacement of `\\/` to `/`. Hopefully it was still clear from the first part of the message. I think a big binary blob is most likely what you're going to be getting. Looking at the app itself seems to be a digital canvas. Most likely what is in that blob is a custom data format made up of `short` `byte` `bool` `int` and probably other data types built from those describing brush style, brush thickness, start point in 2d space, end point in 2d space, perhaps either points along the stroke to fill in the middle, or Bezier information to describe the stroke as a curve. This is just my theory on what I generally know on how this kind of app would be built, but decoding their particular format would be very difficult to reverse engineer without knowing anything about the format to begin with. It's also possible there's some level of encryption over that data before you are seeing the actual data. If they use their own encryption and decryption keys to store the data in the file before they export it, then it's highly unlikely you'll be able to do anything with it. Perhaps if it's keyed to your own passphrase as some E2EE apps do, you might be able to work out which encryption it is and decrypt with your password BUT I don't know if this is the case at all, just throwing out some avenues of exploration depending on how much time you want to spend on this! ---------------------------------------------------------------------- wolfbyknight · 2023-12-17 21:30 Replied to OP in a separate comment but yeah I suspect binary blob is likely either encrypted, or a custom binary serialised format, or both the latter wrapped in the former. There may be avenues to figure it out but it's going to be quite a reverse engineering project I suspect! ---------------------------------------------------------------------- AmountOk3836 · 2023-12-18 06:40 Oh I’m sorry I think I didn’t make it clear in my post, the app is actually a handwritten note taking app so erm it’s meant to display pen strokes. I had originally assumed each stroke was saved as a base64 encoded png but I will give this a try as well. Thanks