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???
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….