File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Managing the keystore through Code

 
Franz Degenhardt
Greenhorn
Posts: 12
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 231
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 137
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic