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 / January 2006

Tip: Looking for answers? Try searching our database.

How to store the generated Key using KeyStore into the File

Thread view: 
ganesh.gulecha@gmail.com - 30 Jan 2006 07:39 GMT
Hi,
   I have the code for reading the available key from the File using
the KeyStore. But, i have tried my best to store the generated key into
the File and i m not able to. Can some one help in these.

Thanks in Advance!

Regards,
Ganesh.G.
Lion-O - 31 Jan 2006 17:04 GMT
> I have the code for reading the available key from the File using the
> KeyStore. But, i have tried my best to store the generated key into the File
> and i m not able to. Can some one help in these.

Actually the only thing you'd need to do is taking a closer look at the
examples in the JDK documentation. The specification for the KeyStore class
also list an example how to load/store keys, check
http://java.sun.com/j2se/1.5.0/docs/api/java/security/KeyStore.html.

Another read which has helped me a lot is
http://java.sun.com/j2se/1.5.0/docs/guide/security/CryptoSpec.html.

But summing up; the only thing you need is to add the key to the keystore using
the "KeyStore.setEntry" method. Once you've done that you can save it using an
FileOutputStream. From the top of my mind:

FileOutputStream fos = new FileOutputStream("name_of_keystore");
KeyStore.store(fos, "keystorepassword");
fos.close();

Now, do check this carefully. I'm not 100% positive that I got it all right,
but am pretty sure on the overall commands.

Signature

Groetjes, Peter

.\\ PGP/GPG key: http://www.catslair.org/pubkey.asc



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.