Xcode 11, decryption is not working - not able to open the encrypted DB from code

Issue facing is - not able to open the encrypted DB from the code - Xcode 11
Steps followed:

  • In my Mac encrypted .db file with the help of CIPHER and set the password.
  • Just dragged and dropped that encrypted .db to my Xcode project.
  • Followed the steps as per the tutorial https://www.zetetic.net/sqlcipher/ios-tutorial/ and written code to decrypt the DB by using the password.

No errors are coming - It was printing the CIPHER version number in all the cases :

  • Attempt to open a database with a correct key and verify that the operation succeeds
  • Attempt to open a database with an incorrect key and verify that the operation succeeds
  • Attempt to open a database without any key, and verify the operation succeeds

Tried both the options-1 and option-2
Please help me out.

Thanks in advance.

Hello @Devan

Thanks for your interest in SQLCipher. Opening and keying a database are precursors to accessing the content within the database. After you have opened the database and provided a key, please then try to read from the database file. A common query to validate the encryption key is correct is to execute the following which will always be present regardless of your application schema:

SELECT count(*) FROM sqlite_master;

Would you give that a try and report your results?