# What will be happen if the app is killed or powered off when update key by sqlite3\_rekey?

**URL:** https://discuss.zetetic.net/t/what-will-be-happen-if-the-app-is-killed-or-powered-off-when-update-key-by-sqlite3-rekey/2649
**Category:** SQLCipher
**Created:** [February 9, 2018, 1:39am UTC](https://discuss.zetetic.net/t/what-will-be-happen-if-the-app-is-killed-or-powered-off-when-update-key-by-sqlite3-rekey/2649 "2018-02-09T01:39:30Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![w00152779](https://avatars.discourse-cdn.com/v4/letter/w/e5b9ba/32.png) [@w00152779](https://discuss.zetetic.net/u/w00152779)
#### Post date: [February 9, 2018, 1:39am UTC](https://discuss.zetetic.net/t/what-will-be-happen-if-the-app-is-killed-or-powered-off-when-update-key-by-sqlite3-rekey/2649/1 "2018-02-09T01:39:30Z")

</div>

Is it possible that some pages is encrypted by the new key and the others is encrypted by the old key?  
Can it recovered when the app is restart?

---

<div class="post-metadata">

### Author: ![developernotes](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.zetetic.net/developernotes/32/1309_2.png) [@developernotes](https://discuss.zetetic.net/u/developernotes)
#### Post date: [February 9, 2018, 2:19pm UTC](https://discuss.zetetic.net/t/what-will-be-happen-if-the-app-is-killed-or-powered-off-when-update-key-by-sqlite3-rekey/2649/2 "2018-02-09T14:19:55Z")

</div>

Hi @w00152779

> [@w00152779](#):
>
> Is it possible that some pages is encrypted by the new key and the others is encrypted by the old key?

No, we create a transaction before we begin the rewrite of each page within the database. You can see that occurring [here](https://github.com/sqlcipher/sqlcipher/blob/c6f709fca81c910ba133aaf6330c28e01ccfe5f8/src/crypto.c#L497).

> [@w00152779](#):
>
> Can it recovered when the app is restart?

What are you trying to recover?

---

<div class="post-metadata">

### Author: ![w00152779](https://avatars.discourse-cdn.com/v4/letter/w/e5b9ba/32.png) [@w00152779](https://discuss.zetetic.net/u/w00152779)
#### Post date: [February 12, 2018, 3:41am UTC](https://discuss.zetetic.net/t/what-will-be-happen-if-the-app-is-killed-or-powered-off-when-update-key-by-sqlite3-rekey/2649/3 "2018-02-12T03:41:08Z")

</div>

Thanks for your replay.
