keystore: fix upgrades
Kenny Root authored
During an upgrade, a blob would be written out to disk. Whenever a blob
is written to disk, it is encrypted in-place. After upgrade, keystore
would attempt to use the blob, but get garbage instead of what it
expected since it was encrypted.

This moves the work of writing up a level so it can then re-read the
blob after upgrade.

(cherry picked from commit cfeae072)

Bug: 7249554
Change-Id: I1be5ecafa6d39fdcce10d9d3623f23440cac8c6e
7a310fbb