aspose file tools*
The moose likes Security and the fly likes Managing the keystore through Code Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Engineering » Security
Bookmark "Managing the keystore through Code " Watch "Managing the keystore through Code " New topic
Author

Managing the keystore through Code

Franz Degenhardt
Greenhorn

Joined: Jan 07, 2003
Posts: 12
I have created a keystore using keytool.
I have tried managing a keystore through the API and was able to generate key pairs and store them. (using setCertificateEntry(), setKeyEntry() etc.) However, I cannot retrive them with getKey().
Calling the method throws the exception
"java.security.UnrecoverableKeyException: DER input, Integer tag
error".
Someone knows how to interpret this error?
Franz Degenhardt
Juanjo Bazan
Ranch Hand

Joined: Feb 04, 2002
Posts: 231
It could be that KeyStore is assuming you try to retrieve a private key.
So when it faces a public key, things go wrong because the expected key (a private key) specified by it Distinguished Encoding Rules(DER) encoding is incorrect.
hth
Jon Dornback
Ranch Hand

Joined: Apr 24, 2002
Posts: 137
Hi, I ran in to this problem awhile back and found a fix for it. My post regarding it is here:
http://www.coderanch.com/t/271557/java/java/case-UnrecoverableKeyException-DER-input-Integer


use the [CODE] tags - it makes it much easier for people to help you.
 
wood burning stoves
 
subject: Managing the keystore through Code
 
Similar Threads
Axis generated client - how to point to keystore
Java 1.4 Keystore Expiration
Connecting to LDAP server using SSL
Corrupt keystore?
Sign a jar with a third party certificate, using keytool and jarsigner