当我尝试将证书导入 java 密钥库时,出现以下异常。
“java.security.cert.CertificateParsingException:无效的 DER 编码证书数据”
FileInputStream fis = new FileInputStream(filename);
BufferedInputStream bis = new BufferedInputStream(fis);
java.security.cert.CertificateFactory cf = java.security.cert.CertificateFactory
.getInstance("X.509");
while (bis.available() > 0) {
Certificate cert = cf.generateCertificate(bis);
if (cert instanceof X509Certificate) {
certFx.addCertificate("vel", (X509Certificate) cert, true);
}
}
任何帮助,将不胜感激 !。