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

Reply via email to