Keystore 2.0: Make key type an explict argument.
This refactor makes key type an explicit to relevant database function
to make it harder to implicitly use the wrong type.
Ignore-AOSP-First: No automerge path from AOSP.
Bug: 187862706
Bug: 189470584
Test: Regression tested with keystore2_test.
Change-Id: I9e1416743093f0a1ab86fd9351aed97f106ee819
Merged-In: I9e1416743093f0a1ab86fd9351aed97f106ee819
diff --git a/keystore2/src/service.rs b/keystore2/src/service.rs
index 1f61729..d65743d 100644
--- a/keystore2/src/service.rs
+++ b/keystore2/src/service.rs
@@ -241,8 +241,13 @@
check_key_permission(KeyPerm::rebind(), &key, &None)
.context("Caller does not have permission to insert this certificate.")?;
- db.store_new_certificate(&key, certificate_chain.unwrap(), &KEYSTORE_UUID)
- .context("Failed to insert new certificate.")?;
+ db.store_new_certificate(
+ &key,
+ KeyType::Client,
+ certificate_chain.unwrap(),
+ &KEYSTORE_UUID,
+ )
+ .context("Failed to insert new certificate.")?;
Ok(())
})
.context("In update_subcomponent.")