IntelliJ Java IDE
The moose likes Other JSE/JEE APIs and the fly likes keystore problem Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Other JSE/JEE APIs
Reply Bookmark "keystore problem" Watch "keystore problem" New topic
Author

keystore problem

Paddy Totti
Greenhorn

Joined: Dec 12, 2001
Posts: 9
hi,I am doing the digital signature.Here is my problem:
After I have create my keystore, i wrote a program to use it. However, when I run this program with this line in dos/mode:
java SignatureTest -s .keystore tsyfhedr Paddy custorder.xml signaturefile
It throws a exception:
Exception in thread "main" java.security.
UnrecoverableKeyException:Cannot recover key
at sun.security.provider.KeyProtector.recover(Unknown Source)
at sun.security.provider.JavaKeyStore.engineGetKey(Unknown Source)
at java.security.KeyStore.getKey(Unknown Source)
at Signature1.main(Signature1.java:32)
Of course, I have create all need and the password is right.
Anyone know why the keystore can't be used ???

child
Greenhorn

Joined: Dec 10, 2001
Posts: 2
Paddy, I also have the similar problem !
I'm trying to authenticate a user using a keystore, this is what I
try:
...
/* Associate a FileReader with the file */
File keyStoreFile = new File("OVS.keystore");
FileInputStream keyStoreFileInputStream
= new FileInputStream(keyStoreFile);

KeyStore ks = KeyStore.getInstance("JKS");
/* load the KeyStore from the given inputstream,
using the given password */
ks.load(keyStoreFileInputStream, password);
ks.getKey(username, password); <<<<<<----- HERE IS PROBLEM ???
// authentication succeeded!!!
passwordCorrect = true;
if (debug)
System.out.println("\t\t[SampleLoginModule] " +
"authentication succeeded");
succeeded = true;
...

I am putting all this in a try-catch block so if ks.getKey(...)
doesn't generate an exception, it means that authentication succeeded,
and if it does generate an exception, i go to the 'authentication did
not succeed' part of my program.
Still, it seems like the ks.getKey(username, password) generates an
exception EVERY TIME that tells me: "Cannot recover key". There _is_
a keystore that i created with the keytool in the working directory.
What am I doing wrong here? How should I authenticate users that are
defined in a KeyStore using the keytool program?
I think we may need to set something on the keystore!
But anyone can help plz!!!~~
 
 
subject: keystore problem
 
Threads others viewed
Digital Signature (key)
getting error while creating keysotre
web service security issue
SSLHandshakeException
gettin error while running program
WebSphere development made easy
without the weight of IBM tools
http://www.myeclipseide.com

cast iron skillet 49er

more from paul wheaton's glorious empire of web junk: cast iron skillet diatomaceous earth rocket mass heater sepp holzer raised garden beds raising chickens lawn care CFL flea control missoula heat permaculture