Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Starting point

0 views
Skip to first unread message

Trebek

unread,
Apr 1, 2002, 2:16:12 PM4/1/02
to
Hello group :

I have been tasked with writing a server application that submits encrypted
data (using their certs) to our client's server and then dycrypt the
response for our use. Although I know Java, I don't know the security
classes at all and am having some real trouble getting started. My client
has provided me with the following files and their associated passwords :

1) <client_num/name>.jks
2) <client_num/name>.p12
3) <server_name>.der
4) <trust>.jks

I am able to instantiate a seemingly valid keystore, which is to say that if
I call methods from this keystore, they work...but I get an error when I
attempt to getKey() that looks like :
java.security.UnrecoverableKeyException: Cannot recover key
at sun.security.provider.KeyProtector.recover(KeyProtector.java:301)
at
sun.security.provider.JavaKeyStore.engineGetKey(JavaKeyStore.java:10
)
at java.security.KeyStore.getKey(KeyStore.java:289)
at CreditServer$Encrypt.setupKey(CreditServer.java:288)
at CreditServer$Encrypt.<init>(CreditServer.java:266)
at CreditServer$Connection.run(CreditServer.java:178)
at java.lang.Thread.run(Thread.java:536)

I have tried to find additional info in the archives, but to no avail.
Below is some of the code I use to build the keystore.

ks = KeyStore.getInstance("JKS");
file://ks = KeyStore.getInstance("JCEKS", "SunJCE");

String keyinfo = KEYSTORE_PATH + KEY_PATH;
ks.load(new FileInputStream(keyinfo), KEY_PASS.toCharArray());

file://This is where it fails
Key test = ks.getKey("alias",KEY_PASS.toCharArray());

I am getting the alias name by calling ks.aliases() and, in iterating thru
the list, only get one name. Even if this is not enough information to
solve the issue, could someone please point me in the right direction where
I might find info about using provided certs to encrypt info?

Thanks,

Alec

0 new messages