Hi Carol,

You can not always copy a private key stored on a token to somewhere
else.  Many of these devices are constructed especially to make this
impossible.  I know for a fact that that this is the case for example
with SmartCards use in the banking world to access secured systems.
In general the best bet to use these from java is through the PKCS#11
implementation.

See the IAIK implementation for example:
http://jce.iaik.tugraz.at/products/15_PKCS11_Provider/Using.php

Good luck,

Johan

-----Original Message-----
From: Carol Chamblas [mailto:[EMAIL PROTECTED] 
Sent: donderdag 26 mei 2005 4:31
To: [email protected]
Subject: sign Files using Aladdin's eToken USB Pro

i had configured tomcat to use secure connections (https), and i've
included 
the root certificated from my CA in the cacerts file from JAVA_HOME.

so, i've also installed the drivers from my eToken, and when i load my
page 
with https, the certificated stored in my eToken is shown.

when i choose it. it ask me for the password, and after i put it, the 
servlet in the other side sees the certificate without problems

the question is, how do i use or obtain the private key stored in the 
eToken??

here is the code that i'm using

XMLSignature sig = *new* XMLSignature(XMLDoc, BaseURI,
XMLSignature.ALGO_ID_SIGNATURE_RSA_SHA1 );
 
            NodeList nl = XMLDoc.getElementsByTagName("Content");
            *if* (nl.getLength() < 1)
            {
                System.out.println("firmar::no hay nodo Content??");
                *return* *false*;
            }
            (nl.item(0)).appendChild(sig.getElement());
           
            {
                 String Id = "S" + (firmantes.size() + 1);
                 Transforms transforms = *new* Transforms(XMLDoc);
 
                
transforms.addTransform(Transforms.TRANSFORM_C14N_OMIT_COMMENTS);
                 sig.addDocument(BaseURI, transforms,
Constants.ALGO_ID_DIGEST_SHA1);
                 sig.setId(Id);
              }
            sig.addKeyInfo(cert);
            sig.addKeyInfo(cert.getPublicKey());
            System.out.println("Start signing");
            sig.sign(privateKey);
            System.out.println("Finished signing");



-- 
"Nada es imposible,
hasta que se demuestre lo contrario" - yo


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to