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.