summaryrefslogtreecommitdiffstats
path: root/keystore
diff options
context:
space:
mode:
Diffstat (limited to 'keystore')
-rw-r--r--keystore/java/android/security/CertTool.java9
-rw-r--r--keystore/jni/cert.c3
2 files changed, 12 insertions, 0 deletions
diff --git a/keystore/java/android/security/CertTool.java b/keystore/java/android/security/CertTool.java
index 1dc575b..5319330 100644
--- a/keystore/java/android/security/CertTool.java
+++ b/keystore/java/android/security/CertTool.java
@@ -63,6 +63,15 @@ public class CertTool {
private native String getPrivateKeyPEM(int handle);
private native void freeX509Certificate(int handle);
+ private static CertTool singleton = null;
+
+ public static final CertTool getInstance() {
+ if (singleton == null) {
+ singleton = new CertTool();
+ }
+ return singleton;
+ }
+
public String getUserPrivateKey(String key) {
return USER_KEY + KEYNAME_DELIMITER + key;
}
diff --git a/keystore/jni/cert.c b/keystore/jni/cert.c
index 07f0e86..cc36b84 100644
--- a/keystore/jni/cert.c
+++ b/keystore/jni/cert.c
@@ -144,6 +144,9 @@ int is_pkcs12(const char *buf, int bufLen)
if (!buf || bufLen < 1) goto err;
+ bp = BIO_new(BIO_s_mem());
+ if (!bp) goto err;
+
if (buf[0] != 48) goto err; // it is not DER.
if (!BIO_write(bp, buf, bufLen)) goto err;