I have a database for an OS X application that has an encrypted database. I use this code to open the database for OS X:
dim myDB as new SQLiteDatabase
myDB.DatabaseFile = specialfolder.documents.child(“mydb.sqlite”)
myDB.EncryptionKey = “12345”
If myDB.Connect Then
countryRS = myDB.SQLSelect(sql)
Catch e As SQLiteException
This works without any problem. Now I have made the application for iOS and the same codes does not work. I get this error:
Error number 26
Reason: file is encrypted or is not a database
When I remove the encryption for the database, then the database will connected and the iOS app is running fine. I could not find any special commands or settings for iOS in the XOJO documentation.
The error message is telling you what went wrong.
No, the error message is not correct. The same code to open the database works on Mac OS X and without the encryption my iOS app can open the database. In the iOS help pages I can see, that database encryption is supported by iOS. Why it does not work?
Perhaps the implementation of the encryption method is different. Does XOJO document that an encrypted database from the desktop version will work with the XOJO iOS platform? or conversely do they document a stance either way. I do know that a SQLite database that I encrypted using a SWIFT engine won’t work on the desktop, or vice versa, but then I also know in that circumstance that algotrithms are vastly different.
In iOS documentation there is encrypt and decrypt for database available.
Yes, but it does not mean the encryption is compatible with desktop.
You may want to decrypt your existing database, save that decrypted version, load it in iOS, and encrypt it there before saving an iOS specific encrypted version that you will subsequently be able to use.