Did you spot the difference in the title? (for me, it took some time)
So I used bouncy castle with connection to java.security.cert.X509Certificate in order
to create certificates. Now I'm looking for a way to create a java.security.cert.X509Certificate from raw bytes. I haven't any method to do this in
java.security.cert.X509Certificate but there is one(the getInstance static method) in
javax.security.cert.X509Certificate.
The problem is I cannot cast a javax.security.cert.X509Certificate to java.security.cert.X509Certificate.
Any ideas on what to do, to transform raw bytes into a java.security.cert.X509Certificate?
Also, what's the differences between the one abstract class and the other class? Why does java has two of them with different functionality?
解决方案
The javax version is deprecated. Use CertificateFactory to generate a certificate from raw bytes. There is an example in the javadocs.