|
From: Pelle B. <pe...@us...> - 2004-04-07 17:35:27
|
Update of /cvsroot/neuclear/neuclear-xmlsig/src/test/org/neuclear/xml/xmlsec In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14729/src/test/org/neuclear/xml/xmlsec Added Files: InteractiveXMLSignature.java Log Message: Added support for the new improved interactive signing model. A new Agent is also available with SwingAgent. The XMLSig classes have also been updated to support this. --- NEW FILE: InteractiveXMLSignature.java --- package org.neuclear.xml.xmlsec; import org.dom4j.DocumentException; import org.dom4j.DocumentHelper; import org.dom4j.Element; import org.neuclear.commons.crypto.passphraseagents.UserCancellationException; import org.neuclear.commons.crypto.passphraseagents.swing.SwingAgent; import org.neuclear.commons.crypto.signers.BrowsableSigner; import org.neuclear.commons.crypto.signers.InvalidPassphraseException; import org.neuclear.commons.crypto.signers.NonExistingSignerException; import org.neuclear.commons.crypto.signers.TestCaseSigner; /* $Id: InteractiveXMLSignature.java,v 1.1 2004/04/07 17:22:23 pelle Exp $ $Log: InteractiveXMLSignature.java,v $ Revision 1.1 2004/04/07 17:22:23 pelle Added support for the new improved interactive signing model. A new Agent is also available with SwingAgent. The XMLSig classes have also been updated to support this. */ /** * User: pelleb * Date: Apr 7, 2004 * Time: 12:07:19 PM */ public class InteractiveXMLSignature { public static void main(String args[]) { try { BrowsableSigner signer = new TestCaseSigner(new SwingAgent()); final Element element = DocumentHelper.parseText(COMPLEX_XML).getRootElement(); XMLSignature sig = new EnvelopedSignature(signer, element); System.out.println(element.asXML()); System.exit(0); } catch (InvalidPassphraseException e) { e.printStackTrace(); } catch (XMLSecurityException e) { e.printStackTrace(); } catch (DocumentException e) { e.printStackTrace(); } catch (NonExistingSignerException e) { e.printStackTrace(); } catch (UserCancellationException e) { e.printStackTrace(); } } final static String COMPLEX_XML = "<test xmlns=\"http://talk.org\"><test2></test2></test>"; } |