• 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

Change password for the KeyStore programmatically

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
HI My Client asked us to create user interface for change the keystore password.

I created KeyStore like this
=====================================================================
KeyStore keystore = KeyStore.getInstance(KeyStore.getDefaultType());
keystore.load(null, keyStorePwd.toCharArray());

FileOutputStream out = new FileOutputStream(keystoreName);
keystore.store(out, keyStorePwd.toCharArray());
out.close();
=====================================================================
But i dont see any method in api to change the password for keystore. Please help me how to change Keystore password from old password to new password.

Thanks in advance.
Dhananjayan Karnam
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The keytool utility does that; you can't do it programmatically.
 
Dhananjay karnam
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
HI Ulf, Thanks for the reply.

We are developing B2B application and in our side we need to provide certificate for calling the other server. So they asked me to create a tool to import certificates to the keystore.

But here my issue is client side security people wants to handle that through some interface, they dont know how to work with the keytool and in production noone have access to that.

So tell me if i have 2 keystores in the classpath (keystore1 and keystore2) and if user request for a change password , then i will point to keystore2 from keystore1 and create that with the said password and export all certificates from keystore1 and save into keystore2. Next time if again request for change password i will create keystore1 with the new password and export all certificates.

The only thing is i need to track which keystore i need to use at runtime.
Is this logic works ulf.
 
reply
    Bookmark Topic Watch Topic
  • New Topic