0

我从 JKS 密钥库中提取了一个证书,并尝试将其转换为 iaik.x509.X509Certificate。sun.security.x509.X509CertImpl 失败,无法转换为 iaik.x509.X509Certificate。有没有办法手动将其写入 iaik.x509.X509Certificate?代码片段 -

        KeyStore trustStore = KeyStore.getInstance(KeyStore.getDefaultType());
        FileInputStream in = new FileInputStream(keystorePath);
        char[] keyPasswordChars = keyPassword == null ? new char[0] : keyPassword.toCharArray();
        try {
                trustStore.load(in, keyPasswordChars);
        } finally   {
                in.close();
        }
        Certificate cert = trustStore.getCertificate(alias);
        if (cert != null) {
            iaik.x509.X509Certificate  x509 = (iaik.x509.X509Certificate) cert;
            return x509;
        }

iaik.x509.X509Certificate 来自 Entrust - enttoolkit.jar

4

0 回答 0