# Issue Migrating From android-database-sqlcipher:3.5.9 to sqlcipher-android:4.5.5

**URL:** <https://discuss.zetetic.net/t/issue-migrating-from-android-database-sqlcipher-3-5-9-to-sqlcipher-android-4-5-5/6370>\
**Category:** SQLCipher\
**Created:** [April 3, 2024, 12:35pm UTC](https://discuss.zetetic.net/t/issue-migrating-from-android-database-sqlcipher-3-5-9-to-sqlcipher-android-4-5-5/6370 "2024-04-03T12:35:43Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![mmoore](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.zetetic.net/mmoore/32/858_2.png) [@mmoore](https://discuss.zetetic.net/u/mmoore)\
**Post date:** [May 7, 2024, 7:19pm UTC](https://discuss.zetetic.net/t/issue-migrating-from-android-database-sqlcipher-3-5-9-to-sqlcipher-android-4-5-5/6370/4 "2024-05-07T19:19:17Z")

</div>

@Anshuman_Biswal

The API documentation for cipher\_migrate is here: [SQLCipher API - Full Database Encryption PRAGMAs, Functions, and Settings | Zetetic](https://www.zetetic.net/sqlcipher/sqlcipher-api/#cipher_migrate)

You’ll want to follow the guidance mentioned in the API documentation for how to determine whether to perform the migration as it is expensive.

There’s an example of calling cipher\_migrate in the postKey hook here: [sqlcipher-android-tests/app/src/main/java/net/zetetic/tests/CipherMigrateTest.java at master · sqlcipher/sqlcipher-android-tests · GitHub](https://github.com/sqlcipher/sqlcipher-android-tests/blob/master/app/src/main/java/net/zetetic/tests/CipherMigrateTest.java)

From your code it looks like you’re hard coding a key value. We strongly recommend against doing that. There’s some information about Key Material and Selection, along with some technical guidance in these posts:

> [@SQLCipher Database Key Material and Selection](https://discuss.zetetic.net/t/sqlcipher-database-key-material-and-selection/25):
>
> By design, SQLCipher doesn’t perform permanent storage of the database password and key material. This provides maximum flexibility, allowing an application to provide key material from any combination of sources (e.g. user provided passphrase, key material on device, external hardware tokens, etc.). While this cleanly separates the management of the key material from the implementation of the database encryption, allowing SQLCipher to address the widest possible set of requirements and use cas…

> **[Technical Guidance: Using Random Values as SQLCipher Keys](https://www.zetetic.net/blog/2019/06/07/technical-guidance-using-random-values-as-sqlcipher-keys/)**
>
> Technical guidance on using random values as SQLCipher keys.

---

_[View the full topic](https://discuss.zetetic.net/t/issue-migrating-from-android-database-sqlcipher-3-5-9-to-sqlcipher-android-4-5-5/6370)._
