You are viewing a plain text version of this content. The canonical link for it is here.
Posted to wss4j-dev@ws.apache.org by co...@apache.org on 2010/05/26 12:41:11 UTC

svn commit: r948389 - /webservices/wss4j/trunk/test/wssec/TestWSSecurityNew3.java

Author: coheigea
Date: Wed May 26 10:41:11 2010
New Revision: 948389

URL: http://svn.apache.org/viewvc?rev=948389&view=rev
Log:
Added a test to programatically construct a PKIPATH BinarySecurityToken.

Modified:
    webservices/wss4j/trunk/test/wssec/TestWSSecurityNew3.java

Modified: webservices/wss4j/trunk/test/wssec/TestWSSecurityNew3.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/test/wssec/TestWSSecurityNew3.java?rev=948389&r1=948388&r2=948389&view=diff
==============================================================================
--- webservices/wss4j/trunk/test/wssec/TestWSSecurityNew3.java (original)
+++ webservices/wss4j/trunk/test/wssec/TestWSSecurityNew3.java Wed May 26 10:41:11 2010
@@ -193,6 +193,34 @@ public class TestWSSecurityNew3 extends 
         verify(signedDoc);
     }
     
+    /**
+     * Test that signs and verifies a WS-Security envelope
+     * <p/>
+     * 
+     * @throws java.lang.Exception Thrown when there is any problem in signing or verification
+     */
+    public void testBSTPKIPathSignature() throws Exception {
+        WSSecSignature builder = new WSSecSignature();
+        builder.setUserInfo("wss40", "security");
+        builder.setKeyIdentifierType(WSConstants.BST_DIRECT_REFERENCE);
+        builder.setUseSingleCertificate(false);
+        LOG.info("Before Signing....");
+        Document doc = SOAPUtil.toSOAPPart(SOAPMSG);
+        WSSecHeader secHeader = new WSSecHeader();
+        secHeader.insertSecurityHeader(doc);
+        
+        Crypto pkiCrypto = CryptoFactory.getInstance("wss40.properties");
+        Document signedDoc = builder.build(doc, pkiCrypto, secHeader);
+
+        if (LOG.isDebugEnabled()) {
+            LOG.debug("After PKI Signing....");
+            String outputString = 
+                org.apache.ws.security.util.XMLUtils.PrettyDocumentToString(signedDoc);
+            LOG.debug(outputString);
+        }
+        
+        secEngine.processSecurityHeader(doc, null, this, pkiCrypto, null);
+    }
     
     /**
      * Test that signs and verifies a WS-Security envelope



---------------------------------------------------------------------
To unsubscribe, e-mail: wss4j-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: wss4j-dev-help@ws.apache.org