[英]javax.security.cert.X509Certificate vs java.security.cert.X509Certificate?
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. 所以我使用了与
java.security.cert.X509Certificate
连接的bouncy castle来创建证书。 Now I'm looking for a way to create a java.security.cert.X509Certificate
from raw bytes. 现在我正在寻找一种从原始字节创建
java.security.cert.X509Certificate
的方法。 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
. 我没有任何方法在
java.security.cert.X509Certificate
执行此操作,但javax.security.cert.X509Certificate
有一个(getInstance静态方法)。
The problem is I cannot cast a javax.security.cert.X509Certificate
to java.security.cert.X509Certificate
. 问题是我无法将
javax.security.cert.X509Certificate
为java.security.cert.X509Certificate
。
Any ideas on what to do, to transform raw bytes into a java.security.cert.X509Certificate
? 关于如何做的任何想法,将原始字节转换为
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?
为什么java中有两个具有不同的功能?
The javax version is deprecated. 不推荐使用javax版本。 Use CertificateFactory to generate a certificate from raw bytes.
使用CertificateFactory从原始字节生成证书。 There is an example in the javadocs.
javadocs中有一个例子。
This happened for me because I am using j2se but imported javax classes. 这件事发生在我身上,因为我使用j2se但导入了javax类。 Certificate and X509Certficate classes exists both in J2SE and in J2EE.
J2SE和J2EE中都存在Certificate和X509Certficate类。
import java.security.KeyStore;
import java.security.cert.CertificateFactory;
import java.security.cert.X509Certificate;
Not these. 不是这些。
import javax.security.cert.X509Certificate;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.