realm / realm-studio

Realm Studio
https://realm.io/products/realm-studio/
Apache License 2.0
304 stars 41 forks source link

Encrypted Realm unable to open in Windows #1581

Closed q-amir closed 1 year ago

q-amir commented 1 year ago

Describe the bug Unable to open encrypted realm on Windows

To Reproduce Steps to reproduce the behavior:

  1. Open Realm Studio on Windows with version 14.03 / 14.02
  2. Open any encrypted realm file
  3. Enter the encryption key
  4. And you will see the same error as the screenshot below

Expected behavior I should be able to see all my data in the realm db. It's work well on my macbook but not on my windows pc

Screenshots image

Versions:

kneth commented 1 year ago

@q-amir Thank you for reporting.

It is possible for you to test using node.js on Windows using a simple script:

const key = new Int8Array([ /* your key */  ] );
let realm = new Realm({ path: "name-of-your-realm-file", encryptionKey: key });
console.log(`Schema: ${realm.schema.length}`);
realm.close();
kneth commented 1 year ago

@q-amir Another question: was the encrypted Realm file created on a non-Windows platform?

q-amir commented 1 year ago

@q-amir Another question: was the encrypted Realm file created on a non-Windows platform?

@kneth Yes. I generate it by using Jenkins in my macbook

@q-amir Thank you for reporting.

It is possible for you to test using node.js on Windows using a simple script:

const key = new Int8Array([ /* your key */  ] );
let realm = new Realm({ path: "name-of-your-realm-file", encryptionKey: key });
console.log(`Schema: ${realm.schema.length}`);
realm.close();

I will try this. let you know.

q-amir commented 1 year ago

@q-amir Thank you for reporting.

It is possible for you to test using node.js on Windows using a simple script:

const key = new Int8Array([ /* your key */  ] );
let realm = new Realm({ path: "name-of-your-realm-file", encryptionKey: key });
console.log(`Schema: ${realm.schema.length}`);
realm.close();

@kneth I just run the simple script and it's failed. Here is the error msg Failed to open the Realm: Error [RealmError]: Failed to open Realm file at path 'D:\Projects\Tests\TestMasterdata\chmd.realm': Realm file decryption failed (Decryption failed)

kneth commented 1 year ago

It might be a duplicate of #1373. Encrypted Realm file might be slightly dependent on the platform where they are created. My little script above will tell us if it is the case.

We have an open issue to fix it.

q-amir commented 1 year ago

It might be a duplicate of #1373. Encrypted Realm file might be slightly dependent on the platform where they are created. My little script above will tell us if it is the case.

We have an open issue to fix it.

@kneth I see. seems like I need to wait for an update. Is there any other way for me to make my realm db more secure?

kneth commented 1 year ago

Is there any other way for me to make my realm db more secure?

Our encryption is pretty good - the issue is how to share it across platforms.

Most operating systems today offer encryption of the file system, which is a good option for the case the device is lost. It is a more general remark unrelated to Realm :smile:

kneth commented 1 year ago

I am closing the issue due to no reply back. Please create a new issue if you have new observations to share.