密钥库的 setkeyentity 的参数
我使用密钥库来保护文件中的私钥,使用以下代码
ks.setKeyEntry("kk1", pr, pass, cert1);//ks is obj of keystore,
//kk1 is alias,
//pr-->is private key,
//pass->is the password to protect that key,
//cert1-->is the certificate chain..
稍后我想将其存储在文件中,使用存储函数。 我的问题是
(actual argument java.security.cert.X509Certificate cannot be converted to java.security.cert.Certificate[] by method invocation conversion)
我已经给出了 cert1,因为
X509V3Create obj=new X509V3Create(); //it is my own class
X509Certificate cert1 = obj.generateV3Certificate(pair);
//in this method I set all the certificate parameters like version,alg etc..,pair is obj of key pair...
我收到了上面提到的错误。我无法将该参数设置为 null(它给出了空指针异常)
我应该传递什么作为参数???
I am using keystore to protect the private key in a file using the following code
ks.setKeyEntry("kk1", pr, pass, cert1);//ks is obj of keystore,
//kk1 is alias,
//pr-->is private key,
//pass->is the password to protect that key,
//cert1-->is the certificate chain..
Later i want to store it in the file,uisng store function.
My problem is
(actual argument java.security.cert.X509Certificate cannot be converted to java.security.cert.Certificate[] by method invocation conversion)
I have given cert1 as
X509V3Create obj=new X509V3Create(); //it is my own class
X509Certificate cert1 = obj.generateV3Certificate(pair);
//in this method I set all the certificate parameters like version,alg etc..,pair is obj of key pair...
I am getting the error which I mentioned above..I can't set that parameter to null(it gives null pointer exception)
What should I pass as argument???
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
试试这个:
Try this: