# Problem with storing key in KeyStore

Marek Rola - Sun Poland - Sales - Channel Support (mr91525@sunwaw.Poland.Sun.COM)
Thu, 26 Aug 1999 19:00:19 +0200 (MET DST)

- Messages sorted by: [ date ][ thread ][ subject ][ author ]
- Next message: Clyde Kunst: "Apples MRJ 2.1.4"
- Previous message: Jan Luehe: "Re: keytool error: Public keys in reply and keystore don't match"
- Next in thread: Jan Luehe: "Re: Problem with storing key in KeyStore"

    Message-Id: <199908261700.TAA05878@Poland.Sun.COM>

    Date: Thu, 26 Aug 1999 19:00:19 +0200 (MET DST)

    From: Marek Rola - Sun Poland - Sales - Channel Support <mr91525@sunwaw.Poland.Sun.COM>

    Subject: Problem with storing key in KeyStore

    To: java-security@java.Sun.COM

Hi Sun Developers

I am a studen on Polish University (Warsaw University of Technology) and now
I'm creating an application in Java 2.

I would like to store SecretKey in KeyStore ("JKS" type) without any Certificates. I have an
exception that I don't really understand.
method :
keyStore.getKey(alias,pchar);
makes exception
java.security.UnrecoverableKeyException: DerInputStream.getLength(): lengthTag=35, too big.

... and it is no problem with password, but rather with storing keys :
keyStore.setKeyEntry(alias, key, pchar, null);
Can I give null Certificate chain for SecretKey or it is the reason my problem and
UnrecoverableKeyException ?

My question: how to store SecretKeys without Certificates in "JKS" type KeyStore. Have I to
call the getEncoded() method on Key object and create my own keyStore format ?
I will be greatful for your fast reply.
(I use Cryptix 3.1 library and threre is no KeyStore provider implementation)

Best regards

Marek.
(as you see, I also work in Sun as student :)

    --
        /\     Marek Rola
       \\ \    Sales Support
      \ \\ /   SUN Microsystems Poland Sp. z o.o.
     / \/ / /  Green House Business Center
    / /   \//\ ul. Hankiewicza 2
    \//\   / / 02-103 Warszawa
     / / /\ /  Tel. +48 22 87 47 806
      / \\ \   Tel. +48 22 87 47 800
       \ \\    Fax  +48 22 658 4060
        \/

- Next message: Clyde Kunst: "Apples MRJ 2.1.4"
- Previous message: Jan Luehe: "Re: keytool error: Public keys in reply and keystore don't match"
- Next in thread: Jan Luehe: "Re: Problem with storing key in KeyStore"