import android.os.Handler;
import android.os.Message;
-import android.security.Keystore;
+import android.security.CertTool;
import android.util.Log;
final class JWebCoreJavaBridge extends Handler {
}
private String[] getKeyStrengthList() {
- return Keystore.getInstance().getSupportedKeyStrenghs();
+ return CertTool.getInstance().getSupportedKeyStrenghs();
}
private String getSignedPublicKey(int index, String challenge, String url) {
// generateKeyPair expects organizations which we don't have. Ignore url.
- return Keystore.getInstance().generateKeyPair(index, challenge, null);
+ return CertTool.getInstance().generateKeyPair(index, challenge, null);
}
private native void nativeConstructor();
import android.os.Handler;
import android.os.Message;
-import android.security.Keystore;
+import android.security.CertTool;
import android.util.Log;
import android.webkit.CacheManager.CacheResult;
import android.widget.Toast;
}
mDataBuilder.releaseChunk(c);
}
- Keystore.getInstance().addCertificate(cert);
+ CertTool.getInstance().addCertificate(cert, mContext);
Toast.makeText(mContext, R.string.certificateSaved,
Toast.LENGTH_SHORT).show();
mBrowserFrame.stopLoading();
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;
}
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;