Re: Problem with KeyStore

Jan Luehe (luehe@laguna.eng.sun.com)
Fri, 28 Aug 1998 09:32:47 -0700 (PDT)

Sangeeta:

> We are trying to write our own provider for the KeyStore in JDK 1.2 .
>
> One of the problems I have noticed is when you try to initialise a keystore
> without having any input data. The docs recommend that we use the following :
>
> keystore.load(null, null)
>
> The Keystore api for the above does not call the corresponding SPI , when
> this call is made. I would like to do something else, when the user tries to
> do a null initialize, but am unable to implement it, as my provider never gets
> invoked. All the call does is , mark the keystore as initialised and returns.
>
> Can this be changed to pass even the null invocation to the provider, so that
> we can decide what to do with such a call ?

You could have a boolean flag "wasLoaded" in your provider
implementation,
which would tell you whether or not the "engineLoad" method was called.

When "engineLoad" is called, you set that flag to true.

When one of the "engineSetX" methods is called for the first time,
you check the flag: if it is still set to FALSE, you can do all the
things you wanted to do when keystore.load(null, null) was called.

Jan