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

Tip: Looking for answers? Try searching our database.

How to insert a Publickey in a Keystore file without using keytol and wihtout a cert file ?

Thread view: 
Pedro Martins - 20 Feb 2006 17:19 GMT
After i read java.security.cert and java.security.keystore i didn't find
any solution of my problem.
The problem is that i want to create n keystores without using the
keytool because i want to export the solution to use with smartcards.
This issue i can do it.
The big problem is after created the public and private key (RSA 1024)
the keystore only allows entry Keystore.PrivateKeyEntry (private key +
certificate chain for the corresponding public key)
How can i do this?
Creat a autocertificate file wiht keytool?
Because i wanted to do with code
Thank you for all the help
robert - 20 Feb 2006 18:53 GMT
> After i read java.security.cert and java.security.keystore i didn't find
> any solution of my problem.
[quoted text clipped - 8 lines]
> Because i wanted to do with code
> Thank you for all the help

Not sure I understand your question. Lets try to focus on what the
Private Key can do and what you want it to do:

PrivateKey pk = null;
java.security.KeyStore ks =
java.security.KeyStore.getInstance(storetype)

pk = (PrivateKey)ks.getKey(privateKeyAlias,
privateKeyPass.toCharArray());

Now, you can store this pk somewhere because it implements
'serializable' . That means it can be store in LDAP for example using
java.schema .

Now you typically need a public key to sign something, often with X509
- which also implements 'serializable' .

X509Certificate cert =
(X509Certificate)ks.getCertificate(privateKeyAlias);

sig.addKeyInfo(cert);
sig.addKeyInfo(cert.getPublicKey());
// Sign the XML Signature document with our private key
sig.sign(privateKey);

Does the above solve, or not solve, your problem? It seems like you
can´t create the cert - not sure why.

HTH,
iksrazal
http://www.braziloutsource.com/
Roedy Green - 24 Feb 2006 20:50 GMT
On Mon, 20 Feb 2006 17:19:09 +0000, Pedro Martins
<a2035@alunos.det.ua.pt> wrote, quoted or indirectly quoted someone
who said :

>Creat a autocertificate file wiht keytool?

you need to get a book on how the JCE interface works.  Read the Feghi
book. It is full of complete examples.  It is somewhat dated, but it
will get you started.. See http://mindprod.com/jgloss/jce.html
Signature

Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.



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



©2009 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.