未通过密钥库获取相同的密钥值
我使用密钥库将私钥存储在文件中,
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..
在存储到文件时打印了“pr”(私钥)。 我的另一个程序打开了文件并使用 isKeyentry 方法读取内容并使用 getkey 打印私钥...
我没有得到相同的两个(私钥)值...(密码很好,因为如果文件错误打不开)..怎么了??? 需要一样吗???
I stored private key in a file using keystore
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..
I printed "pr"(private key) while storing to the file.
I another program I opened the file and read the contents using method isKeyentry and printing Private key using getkey....
I am not getting the both(private key) values same...(password is fine because if it is wrong the file will not open)..What's wrong????
Does it need to be same???
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
无法使用 hashcode、toStirng 等任何参数来验证 2 个键值。
这是我遵循的方法:
我尝试使用这两个密钥加密一些数据,并验证我是否获得相同的数据。比较时使用 Array.equals() 因为我们在加密后获得字节数组。
我这样做只是为了知道我是否正在检索使用密钥库保存在文件中的相同密钥。
谢谢....
It is not possible to verify 2 key values with any parameter like hashcode,toStirng etc.
This is the method I followed:
I tried to encrypt some data using both the keys and verified if I am getting same data or not.Whle comparing use Array.equals() since we get byte array after encrypting.
I did this just to know whether I am retrieving the same key that I kept in a file using keystore.
Thank you....
您如何衡量等效性?我能想到的最简单、最安全的方法是执行以下操作:
How are you measuring equivalence? The simplest, safest, method I can think of would be to do the following: