summaryrefslogtreecommitdiff
path: root/keystore
diff options
context:
space:
mode:
authorSeth Moore <sethmo@google.com>2021-08-19 09:11:01 -0700
committerSeth Moore <sethmo@google.com>2021-08-24 11:26:02 -0700
commit709894531429f9a06b96991239000590c83a7f87 (patch)
tree7a3decdcf4873c09f2ff26ec945b194be776dc67 /keystore
parent1902c78ce2d1298f14b8fc6c560d6cfb9938366b (diff)
Fix key alias string comparison
The code was doing a reference compare, not object value comparison, resulting in failures in the KeyStore setEntry API. Test: CtsKeystoreTestCases:android.keystore.cts.AndroidKeyStoreTest Bug: 197138784 Change-Id: I2c5e47283eed5694951869e9ea3853364ddef9d1 Merged-In: I2c5e47283eed5694951869e9ea3853364ddef9d1
Diffstat (limited to 'keystore')
-rw-r--r--keystore/java/android/security/keystore2/AndroidKeyStoreSpi.java2
1 files changed, 1 insertions, 1 deletions
diff --git a/keystore/java/android/security/keystore2/AndroidKeyStoreSpi.java b/keystore/java/android/security/keystore2/AndroidKeyStoreSpi.java
index f3cfcf18dec1..67358c4f3255 100644
--- a/keystore/java/android/security/keystore2/AndroidKeyStoreSpi.java
+++ b/keystore/java/android/security/keystore2/AndroidKeyStoreSpi.java
@@ -579,7 +579,7 @@ public class AndroidKeyStoreSpi extends KeyStoreSpi {
//
// Note: mNamespace == KeyProperties.NAMESPACE_APPLICATION implies that the target domain
// is Domain.APP and Domain.SELINUX is the target domain otherwise.
- if (alias != descriptor.alias
+ if (!alias.equals(descriptor.alias)
|| descriptor.domain != targetDomain
|| (descriptor.domain == Domain.SELINUX && descriptor.nspace != targetNamespace)) {
throw new KeyStoreException("Can only replace keys with same alias: " + alias