realm WriteCopyTo backup works - opening file failes with decryption failed
See original GitHub issueGoals
When I try to open encrypted backed up realm file from Realm studio, with the same encryption key that it was configured it says decryption failed.
Unable to open a realm at path 'C:\Users\Foo\Desktop\123.realm': Realm file decryption failed.
Expected Results
Should be able to open realm file.
Actual Results
decryption failes even though file was not suspended realm file.
Unable to open a realm at path 'C:\Users\Foo\Desktop\123.realm': Realm file decryption failed.
Steps to Reproduce
Code Sample
Using
var realmInstance = Realm.GetInstance(config);
var configNew = new RealmConfiguration(Path.GetTempFileName())
{
EncryptionKey = realmInstance.Config.EncryptionKey
};
File.Delete(configNew.DatabasePath);
realmInstance.Write(() =>
{
realmInstance.WriteCopy(configNew);
});
realmInstance.WriteCopy(configNew);
Key
string planKey= BitConverter.ToString(realmInstance.Config.EncryptionKey).Replace("-", string.Empty);
Another method tried to backup realm file.
realmInstance.Dispose();
And
Copying the file at realmInstance.Config.DatabasePath
with Java native stream method.
Still the same error
Version of Realm and Tooling
using Xamarin Forms Realm Nuget package v 3.2.1 Realm Studio - 2.9.0
- Realm Object Server Version: ?
- Flavor:
- Developer
- Professional
- Enterprise
- Server OS & Version: ? Using Realm database
- Client SDK Version: ? NA
- Client OS & Version: ?Windows for Realm Studio , Android for .realm
Issue Analytics
- State:
- Created 5 years ago
- Comments:11 (4 by maintainers)
Yes, you can open the file on the same Android device.
The way Realm encryption works is dependent on the size of a memory page - usually that’s different between 32bit and 64bit devices (or more specifically the architecture of the app, not the device).
I supposed you can open the same encrypted realm file created on a 64bit Android device on a 64bit iOS device, provided your app is running in the same architecture in both cases, but if you want to share encrypted realm files between devices you should really take the hardware difference into account.
Unencrypted realm files can be open on any platform, regardless of where they were first created.
Only contributors can add.