Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   Java (http://www.velocityreviews.com/forums/f30-java.html)
-   -   How to insert a Publickey in a Keystore file without using keytoland wihtout a cert file ? (http://www.velocityreviews.com/forums/t150448-how-to-insert-a-publickey-in-a-keystore-file-without-using-keytoland-wihtout-a-cert-file.html)

Pedro Martins 02-20-2006 05:19 PM

How to insert a Publickey in a Keystore file without using keytoland wihtout a cert file ?
 
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 02-20-2006 06:53 PM

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

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/


Roedy Green 02-24-2006 08:50 PM

Re: How to insert a Publickey in a Keystore file without using keytol and wihtout a cert file ?
 
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
--
Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.


All times are GMT. The time now is 11:58 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.