1

I have to write an utility for digital signing. I have already done it using following sample code.

KeyStore ks = KeyStore.getInstance(KeyStoreType);
ks.load(new java.io.FileInputStream(pfxPath), password.toCharArray());

Now the problem/requirement is, that PFX owner is not ready to share the password and I also don't want to load PFX file every time since I assume thousands of hits in a second.

My question is, is there any way so i can create some keystore(or certificate database or something else) where PFX owner enters password first time and I can use this keystore further for signing.

3
  • 3
    Where is the problem with executing this code once at start of the program (or for first use), and then reusing this same keystore? Jul 25, 2011 at 15:39
  • There is no problem with the code. My sample code can sign any data. But every time i need to provide PFX file and its password. If I make it static KS then I would have to provide password on starting. But I am making web based application. How would i pass password 1st time there?
    – noquery
    Jul 26, 2011 at 5:55
  • On what infrastructure is your application running? If you are using servlets you could pass a init-param? link
    – PhilW
    Jul 26, 2011 at 8:26

1 Answer 1

1

You can develop a standalone code which can generate a serialized file having KS object. Your client can pass his password at his machine. So it'll be risk free.

You can deserialize file contents in your application for further use.

1
  • 1
    One more idea came in my mind after reading your answer, what if my standalone application create keystore and i use that keystore in my code. No serialization/deserialization will be required in this case.
    – noquery
    Aug 10, 2011 at 8:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.