diff options
author | Chung-yih Wang <cywang@google.com> | 2009-07-02 19:11:11 +0800 |
---|---|---|
committer | Chung-yih Wang <cywang@google.com> | 2009-07-02 23:08:39 +0800 |
commit | fa927c046a916fceb077d1ecf2552d76e73da912 (patch) | |
tree | 1bd090be6f71aa36b96e3a2218b6f9b97316af3e /keystore/java | |
parent | eec11827a6c06b029030f43c8d54fd871cc3347d (diff) | |
download | frameworks_base-fa927c046a916fceb077d1ecf2552d76e73da912.zip frameworks_base-fa927c046a916fceb077d1ecf2552d76e73da912.tar.gz frameworks_base-fa927c046a916fceb077d1ecf2552d76e73da912.tar.bz2 |
Remove the null-termination for Java string compatibility.
1. Also change the keyname delimiter in CertTool.java.
2. Return NOTFOUND if the result.len==0 in the listKeys().
3. Define the keystore states in the class Keystore.
Diffstat (limited to 'keystore/java')
-rw-r--r-- | keystore/java/android/security/CertTool.java | 2 | ||||
-rw-r--r-- | keystore/java/android/security/Keystore.java | 14 |
2 files changed, 12 insertions, 4 deletions
diff --git a/keystore/java/android/security/CertTool.java b/keystore/java/android/security/CertTool.java index 285def2..1dc575b 100644 --- a/keystore/java/android/security/CertTool.java +++ b/keystore/java/android/security/CertTool.java @@ -51,7 +51,7 @@ public class CertTool { private static final String USER_CERTIFICATE = "USRCERT"; private static final String USER_KEY = "USRKEY"; - private static final String KEYNAME_DELIMITER = " "; + private static final String KEYNAME_DELIMITER = "_"; private static final Keystore keystore = Keystore.getInstance(); private native String generateCertificateRequest(int bits, String subject); diff --git a/keystore/java/android/security/Keystore.java b/keystore/java/android/security/Keystore.java index 462645a..1f14da7 100644 --- a/keystore/java/android/security/Keystore.java +++ b/keystore/java/android/security/Keystore.java @@ -25,6 +25,12 @@ public abstract class Keystore { private static final String TAG = "Keystore"; private static final String[] NOTFOUND = new String[0]; + // Keystore States + public static final int BOOTUP = 0; + public static final int UNINITIALIZED = 1; + public static final int LOCKED = 2; + public static final int UNLOCKED = 3; + /** */ public static Keystore getInstance() { @@ -195,9 +201,11 @@ public abstract class Keystore { public String[] listKeys(String namespace) { Reply result = mServiceCommand.execute(ServiceCommand.LIST_KEYS, namespace); - return (result != null) ? ((result.returnCode != 0) ? NOTFOUND : - new String(result.data, 0, result.len).split("\\s+")) - : NOTFOUND; + if ((result == null) || (result.returnCode != 0) || + (result.len == 0)) { + return NOTFOUND; + } + return new String(result.data, 0, result.len).split("\\s+"); } @Override |