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 / General / August 2006

Tip: Looking for answers? Try searching our database.

To generate a KeyPair Object from a (encrypted using password) string

Thread view: 
Night82 - 18 Aug 2006 09:14 GMT
I need to save permanently a KeyPair Object (I mean a public RSA key
and a private RSA key). So I'm thinking to save it on a file protected
by a password.

How Can I do that?
Thomas Weidenfeller - 18 Aug 2006 09:55 GMT
> I need to save permanently a KeyPair Object (I mean a public RSA key
> and a private RSA key). So I'm thinking to save it on a file protected
> by a password.
>
> How Can I do that?

The public key by definition does not need to be protected. For a
private key, you maybe want java.security.KeyStore. You can also add the
public key to the KeyStore by wrapping it in a self-signed certificate,
and then adding the certificate to the keyStore.

/Thomas
Signature

The comp.lang.java.gui FAQ:
ftp://ftp.cs.uu.nl/pub/NEWS.ANSWERS/computer-lang/java/gui/faq
http://www.uni-giessen.de/faq/archiv/computer-lang.java.gui.faq/

Night82 - 18 Aug 2006 12:46 GMT
Thomas Weidenfeller ha scritto:

> > I need to save permanently a KeyPair Object (I mean a public RSA key
> > and a private RSA key). So I'm thinking to save it on a file protected
[quoted text clipped - 12 lines]
> ftp://ftp.cs.uu.nl/pub/NEWS.ANSWERS/computer-lang/java/gui/faq
> http://www.uni-giessen.de/faq/archiv/computer-lang.java.gui.faq/

Ok so I create a keystore with:
KeyStore ks = KeyStore.getInstance("JKS");
Now how I can store the key? I've seen the comand:
setKeyEntry(String alias, byte[] key, Certificate[] chain)
but I've no certificate. Only the PrivateKey (to store) and the
password to safe it.
PS what "JKS"?
Thomas Weidenfeller - 18 Aug 2006 13:22 GMT
> Ok so I create a keystore with:
> KeyStore ks = KeyStore.getInstance("JKS");
> Now how I can store the key? I've seen the comand:
> setKeyEntry(String alias, byte[] key, Certificate[] chain)
> but I've no certificate.

Create one.

> Only the PrivateKey (to store) and the
> password to safe it.
> PS what "JKS"?

Please read Sun's documentation for a start:

http://java.sun.com/j2se/1.5.0/docs/guide/security/CryptoSpec.html

/Thomas
Signature

The comp.lang.java.gui FAQ:
ftp://ftp.cs.uu.nl/pub/NEWS.ANSWERS/computer-lang/java/gui/faq
http://www.uni-giessen.de/faq/archiv/computer-lang.java.gui.faq/

Night82 - 21 Aug 2006 08:50 GMT
In order to use the Signature with the algorithm "SHA1withDSA", what
provider have I to install?


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.