本文介绍了Bouncycastle:X509CertificateHolder到X509Certificate?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在r146之前的版本中,可以直接创建 X509Certificate 对象。
现在API已经被弃用,新的​​API只能提供 X509CertificateHolder 对象。

In versions prior to r146 it was possible to create X509Certificate objects directly.Now that API is deprecated and the new one only deliveres a X509CertificateHolder object.

一种将 X509CertificateHolder 转换为 X509Certificate 的方法。

推荐答案

我会回答自己的问题,但不会删除它,同样的问题:

I will answer to my own questions, but not delete it, in case someone else got the same problems:

return new JcaX509CertificateConverter().setProvider( "BC" )
  .getCertificate( certificateHolder );

而对于属性证书:

return new X509V2AttributeCertificate( attributeCertificateHolder.getEncoded() );

不好,因为它是编码和解码,但它工作。

Not nice, as it is encoding and decoding, but it works.

这篇关于Bouncycastle:X509CertificateHolder到X509Certificate?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-27 21:31