能,我用的就是,但是这个错误我没遇到过

解决方案 »

  1.   

    可以 加载证书private KeyStore getKeyStore() throws IOException {
    AssetManager am = getApplicationContext().getAssets();
    InputStream ins = am.open("srca.cer");
    try {
    // 读取证书
    CertificateFactory cerFactory = CertificateFactory
    .getInstance("X.509"); // 问1
    Certificate cer = cerFactory.generateCertificate(ins);
    // 创建一个证书库,并将证书导入证书库
    KeyStore keyStore = KeyStore.getInstance("PKCS12", "BC"); // 问2
    keyStore.load(null, null);
    keyStore.setCertificateEntry("trust", cer);
    return keyStore;
    } catch (Exception e) {
    return null;
    } finally {
    ins.close();
    }
    }这是我自己写的一段 证书获取的代码