我从 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.
任何帮助表示赞赏。