Add argument to binder call to check key types

Before there was only one key type supported, so we didn't need to query
a key type. Now there is DSA, EC, and RSA, so there needs to be another
argument.

Bug: 10600582
Change-Id: I9fe9e46b9ec9cfb2f1246179b2c396216b2c1fdb
This commit is contained in:
Kenny Root
2013-09-05 13:03:16 -07:00
parent d2676f9bd9
commit b91773bce1
3 changed files with 15 additions and 5 deletions

View File

@@ -34,6 +34,7 @@ import java.security.cert.CertificateException;
import java.security.cert.CertificateFactory;
import java.security.cert.X509Certificate;
import java.util.List;
import java.util.Locale;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.LinkedBlockingQueue;
@@ -364,7 +365,8 @@ public final class KeyChain {
* "RSA").
*/
public static boolean isKeyAlgorithmSupported(String algorithm) {
return "RSA".equals(algorithm);
final String algUpper = algorithm.toUpperCase(Locale.US);
return "DSA".equals(algUpper) || "EC".equals(algUpper) || "RSA".equals(algUpper);
}
/**
@@ -379,7 +381,7 @@ public final class KeyChain {
return false;
}
return KeyStore.getInstance().isHardwareBacked();
return KeyStore.getInstance().isHardwareBacked(algorithm);
}
private static X509Certificate toCertificate(byte[] bytes) {