之间
i从xml文件提取x509certificate数据
<X509Data>
<X509Certificate>
MIIB7DCCAVmgAwIBAgIQPjHcBTL63bBLuJZ88RcrCjAJBgUrDgMCHQUAMBExDzANBgNVBAMT
BnJvbWVvazAgFw0xMDAzMTUwMjI1MjZaGA8yMTEwMDIxOTAyMjUyNlowETEPMA0GA1UEAxMG
cm9tZW9rMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDAu/sBh13A27rR7gJpZsI6zCee
TXNohQWlq2z6Zg8Oxzsy5JoVV....==
</X509Certificate>
</X509Data>
如何从此数据中创建Java x509certificate?
我已经尝试了
CertificateFactory cf = CertificateFactory.getInstance(X_509);
ByteArrayInputStream bais = new ByteArrayInputStream(certBytes);
X509Certificate x509cert = (X509Certificate) cf.generateCertificate(bais);
bais.close();
但是发生错误
java.security.cert.CertificateParsingException: invalid DER-encoded certificate data.
任何帮助都将不胜感激。
这些字节是pem。Java可以处理它,但是如果将其封闭在" -----开始证书------"one_answers" -----结束证书-----"