Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / Security / November 2005

Tip: Looking for answers? Try searching our database.

Kava API for Keytool

Thread view: 
tremalnaik@gmail.com - 03 Nov 2005 10:45 GMT
Hello,
I'm developing a swing application to produce certificates easily, for
users who don't like typing commands into the console.

I'm trying to write some java code which let me do something equivalent
to the following command:

C:\Documents and Settings\tremalnaik>keytool -genkey -alias
server.alias.com -keyalg RSA -keypass pass1 -storepass pass2 -keystore
keystore.jks -validity num_days

I searched the JAVA cryptographic  API but they  gave me the impression
they don't let you create a keystore, but only load it from a file.

Alternatively, I may use the Runtime.exec(), but I don't like very much
this solution.

Can you help me?

TREMALNAIK
Tommy Grändefors - 03 Nov 2005 18:31 GMT
Hi,

Don't use Runtime.exec().
You can create a new key store from the method
'KeyStore.load(InputStream stream, char[] password)' by using null as
input parameters (please read the javadoc for that method). When you
have finished working with your key store, then you have to use method
'KeyStore.store(OutputStream stream, char[] password)' to save it on
disk.

Here's how to create a new jks key store:

  KeyStore ks = KeyStore.getInstance("JKS");
  ks.load(null, null);

Good luck with your application.

Regards,
Tommy Grändefors
www.pheox.com

> Hello,
> I'm developing a swing application to produce certificates easily, for
[quoted text clipped - 16 lines]
>
> TREMALNAIK


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.