keystore: Read KeyBlob after type change
During type change, the keyblob gets encrypted,
read keyblob again to decrypt the keyblob.
Change-Id: I74e9c4b835e165d71a5e4a265496247bf72a6737
diff --git a/keystore/keystore.cpp b/keystore/keystore.cpp
index 65a8ea9..609a578 100644
--- a/keystore/keystore.cpp
+++ b/keystore/keystore.cpp
@@ -1201,6 +1201,15 @@
if (keyBlob->getType() == TYPE_KEY_PAIR) {
keyBlob->setType(TYPE_KEYMASTER_10);
rc = this->put(filename, keyBlob, userId);
+ if (rc != NO_ERROR) {
+ return rc;
+ }
+
+ rc = keyBlob->readBlob(filename, userState->getDecryptionKey(),
+ userState->getState());
+ if (rc != NO_ERROR) {
+ return rc;
+ }
}
if (type != TYPE_ANY && keyBlob->getType() != type) {