File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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
JavaRanch » Java Forums » Engineering » Security
Bookmark "Managing the keystore through Code " Watch "Managing the keystore through Code " New topic

Managing the keystore through Code

Franz Degenhardt

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
" DER input, Integer tag
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.
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:

use the [CODE] tags - it makes it much easier for people to help you.
I agree. Here's the link:
subject: Managing the keystore through Code
It's not a secret anymore!