summaryrefslogtreecommitdiffstats
path: root/keystore/java/android
diff options
context:
space:
mode:
authorShawn Willden <swillden@google.com>2015-04-15 18:21:41 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2015-04-15 18:21:41 +0000
commit250dd262910c3a79e87746d3c5519cb3c7e66cab (patch)
tree1f742144dc80584f12a3ef0ae026d9b1b1d98959 /keystore/java/android
parentaaa297056503064eadfa15d9b4fd416f7a35f631 (diff)
parent763100e6442494a85cfcb7949c8021836071b1f6 (diff)
downloadframeworks_base-250dd262910c3a79e87746d3c5519cb3c7e66cab.zip
frameworks_base-250dd262910c3a79e87746d3c5519cb3c7e66cab.tar.gz
frameworks_base-250dd262910c3a79e87746d3c5519cb3c7e66cab.tar.bz2
am 763100e6: am 1cb119d3: am 71ba4e46: Merge "Unbreak obtaining symmetric keys from AndroidKeyStore."
* commit '763100e6442494a85cfcb7949c8021836071b1f6': Unbreak obtaining symmetric keys from AndroidKeyStore.
Diffstat (limited to 'keystore/java/android')
-rw-r--r--keystore/java/android/security/AndroidKeyStore.java15
1 files changed, 10 insertions, 5 deletions
diff --git a/keystore/java/android/security/AndroidKeyStore.java b/keystore/java/android/security/AndroidKeyStore.java
index b931774..1c068be 100644
--- a/keystore/java/android/security/AndroidKeyStore.java
+++ b/keystore/java/android/security/AndroidKeyStore.java
@@ -55,6 +55,7 @@ import java.util.Date;
import java.util.Enumeration;
import java.util.HashSet;
import java.util.Iterator;
+import java.util.List;
import java.util.Set;
import javax.crypto.SecretKey;
@@ -116,11 +117,15 @@ public class AndroidKeyStore extends KeyStoreSpi {
throw new UnrecoverableKeyException("Key algorithm unknown");
}
- int keymasterDigest =
- keyCharacteristics.hwEnforced.getInt(KeymasterDefs.KM_TAG_DIGEST, -1);
- if (keymasterDigest == -1) {
- keymasterDigest =
- keyCharacteristics.swEnforced.getInt(KeymasterDefs.KM_TAG_DIGEST, -1);
+ List<Integer> keymasterDigests =
+ keyCharacteristics.getInts(KeymasterDefs.KM_TAG_DIGEST);
+ int keymasterDigest;
+ if (keymasterDigests.isEmpty()) {
+ keymasterDigest = -1;
+ } else {
+ // More than one digest can be permitted for this key. Use the first one to form the
+ // JCA key algorithm name.
+ keymasterDigest = keymasterDigests.get(0);
}
String keyAlgorithmString;