I have an iOS app that use a non-encrypted realm database.
Now I would like to apply encryption on that database.
Can I just set an encryption key using:
Realm.setEncryptionKey(key, forPath: Realm.defaultPath)
and then realm will encrypt the existing database?
Or do I need to create a new realm database file with encryption and then move the data in the existing database to the new encrypted database?
Realm transparently encrypts and decrypts data with standard AES-256 encryption using the first 256 bits of the given 512-bit encryption key. Realm uses the other 256 bits of the 512-bit encryption key to validate integrity using a hash-based message authentication code (HMAC) .
Transparent data encryption (TDE) encrypts SQL Server, Azure SQL Database, and Azure Synapse Analytics data files. This encryption is known as encrypting data at rest. To help secure a database, you can take precautions like: Designing a secure system.
You'll have to create an encrypted copy of the unencrypted Realm file, which you can do by using Realm().writeCopyToPath(_:encryptionKey:)
and then you can use the encrypted file at the new location.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With