Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > How to insert a Publickey in a Keystore file without using keytoland wihtout a cert file ?

Reply
Thread Tools

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

 
 
Pedro Martins
Guest
Posts: n/a
 
      02-20-2006
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























































 
Reply With Quote
 
 
 
 
robert
Guest
Posts: n/a
 
      02-20-2006

Pedro Martins escreveu:

> 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


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/

 
Reply With Quote
 
 
 
 
Roedy Green
Guest
Posts: n/a
 
      02-24-2006
On Mon, 20 Feb 2006 17:19:09 +0000, Pedro Martins
<(E-Mail Removed)> 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
--
Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
microsoft.public.certification, microsoft.public.cert.exam.mcsa, microsoft.public.cert.exam.mcad, microsoft.public.cert.exam.mcse, microsoft.public.cert.exam.mcsd loyola MCSE 4 11-15-2006 02:40 AM
microsoft.public.certification, microsoft.public.cert.exam.mcsa, microsoft.public.cert.exam.mcad, microsoft.public.cert.exam.mcse, microsoft.public.cert.exam.mcsd loyola Microsoft Certification 3 11-14-2006 05:18 PM
microsoft.public.certification, microsoft.public.cert.exam.mcsa, microsoft.public.cert.exam.mcad, microsoft.public.cert.exam.mcse, microsoft.public.cert.exam.mcsd realexxams@yahoo.com Microsoft Certification 0 05-10-2006 02:35 PM
read a PublicKey-String into a PublicKey-object Sven Bluege Java 1 09-21-2005 06:25 PM
KeyStore and PublicKey Rogue Chameleon Java 3 09-27-2004 05:43 PM



Advertisments