• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Managing the keystore through Code

 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 231
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 137
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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:
https://coderanch.com/t/271557/java/java/case-UnrecoverableKeyException-DER-input-Integer
 
reply
    Bookmark Topic Watch Topic
  • New Topic