ws-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gi...@apache.org
Subject svn commit: r1295267 [11/11] - in /webservices/wss4j/branches/swssf: rampart-policy/src/main/java/org/apache/ws/secpolicy/builders/ streaming-ws-policy/src/main/java/org/swssf/policy/ streaming-ws-policy/src/main/java/org/swssf/policy/assertionStates/ ...
Date Wed, 29 Feb 2012 20:54:56 GMT
Modified: webservices/wss4j/branches/swssf/streaming-xml-security/src/main/java/org/swssf/xmlsec/impl/algorithms/ECDSAUtils.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/swssf/streaming-xml-security/src/main/java/org/swssf/xmlsec/impl/algorithms/ECDSAUtils.java?rev=1295267&r1=1295266&r2=1295267&view=diff
==============================================================================
--- webservices/wss4j/branches/swssf/streaming-xml-security/src/main/java/org/swssf/xmlsec/impl/algorithms/ECDSAUtils.java
(original)
+++ webservices/wss4j/branches/swssf/streaming-xml-security/src/main/java/org/swssf/xmlsec/impl/algorithms/ECDSAUtils.java
Wed Feb 29 20:54:51 2012
@@ -29,16 +29,15 @@ public final class ECDSAUtils {
     private ECDSAUtils() {
         // complete
     }
-    
+
     /**
      * Converts an ASN.1 ECDSA value to a XML Signature ECDSA Value.
-     *
+     * <p/>
      * The JAVA JCE ECDSA Signature algorithm creates ASN.1 encoded (r,s) value
      * pairs; the XML Signature requires the core BigInteger values.
      *
      * @param asn1Bytes
      * @return the decode bytes
-     *
      * @throws IOException
      * @see <A HREF="http://www.w3.org/TR/xmldsig-core/#dsa-sha1">6.4.1 DSA</A>
      * @see <A HREF="ftp://ftp.rfc-editor.org/in-notes/rfc4050.txt">3.3. ECDSA Signatures</A>
@@ -60,51 +59,51 @@ public final class ECDSAUtils {
         byte rLength = asn1Bytes[offset + 1];
         int i;
 
-        for (i = rLength; (i > 0) && (asn1Bytes[(offset + 2 + rLength) - i] ==
0); i--);
+        for (i = rLength; (i > 0) && (asn1Bytes[(offset + 2 + rLength) - i] ==
0); i--) ;
 
         byte sLength = asn1Bytes[offset + 2 + rLength + 1];
         int j;
 
         for (j = sLength;
-            (j > 0) && (asn1Bytes[(offset + 2 + rLength + 2 + sLength) - j] ==
0); j--);
+             (j > 0) && (asn1Bytes[(offset + 2 + rLength + 2 + sLength) - j] ==
0); j--)
+            ;
 
         int rawLen = Math.max(i, j);
 
         if ((asn1Bytes[offset - 1] & 0xff) != asn1Bytes.length - offset
-            || (asn1Bytes[offset - 1] & 0xff) != 2 + rLength + 2 + sLength
-            || asn1Bytes[offset] != 2
-            || asn1Bytes[offset + 2 + rLength] != 2) {
+                || (asn1Bytes[offset - 1] & 0xff) != 2 + rLength + 2 + sLength
+                || asn1Bytes[offset] != 2
+                || asn1Bytes[offset + 2 + rLength] != 2) {
             throw new IOException("Invalid ASN.1 format of ECDSA signature");
-        } 
-        byte xmldsigBytes[] = new byte[2*rawLen];
+        }
+        byte xmldsigBytes[] = new byte[2 * rawLen];
 
         System.arraycopy(asn1Bytes, (offset + 2 + rLength) - i, xmldsigBytes, rawLen - i,
i);
         System.arraycopy(asn1Bytes, (offset + 2 + rLength + 2 + sLength) - j, xmldsigBytes,
-                         2*rawLen - j, j);
+                2 * rawLen - j, j);
 
-        return xmldsigBytes;      
+        return xmldsigBytes;
     }
 
     /**
      * Converts a XML Signature ECDSA Value to an ASN.1 DSA value.
-     *
+     * <p/>
      * The JAVA JCE ECDSA Signature algorithm creates ASN.1 encoded (r,s) value
      * pairs; the XML Signature requires the core BigInteger values.
      *
      * @param xmldsigBytes
      * @return the encoded ASN.1 bytes
-     *
      * @throws IOException
      * @see <A HREF="http://www.w3.org/TR/xmldsig-core/#dsa-sha1">6.4.1 DSA</A>
      * @see <A HREF="ftp://ftp.rfc-editor.org/in-notes/rfc4050.txt">3.3. ECDSA Signatures</A>
      */
     public static byte[] convertXMLDSIGtoASN1(byte xmldsigBytes[]) throws IOException {
 
-        int rawLen = xmldsigBytes.length/2;
+        int rawLen = xmldsigBytes.length / 2;
 
         int i;
 
-        for (i = rawLen; (i > 0) && (xmldsigBytes[rawLen - i] == 0); i--);
+        for (i = rawLen; (i > 0) && (xmldsigBytes[rawLen - i] == 0); i--) ;
 
         int j = i;
 
@@ -114,11 +113,11 @@ public final class ECDSAUtils {
 
         int k;
 
-        for (k = rawLen; (k > 0) && (xmldsigBytes[2*rawLen - k] == 0); k--);
+        for (k = rawLen; (k > 0) && (xmldsigBytes[2 * rawLen - k] == 0); k--)
;
 
         int l = k;
 
-        if (xmldsigBytes[2*rawLen - k] < 0) {
+        if (xmldsigBytes[2 * rawLen - k] < 0) {
             l += 1;
         }
 
@@ -148,7 +147,7 @@ public final class ECDSAUtils {
         asn1Bytes[offset++] = 2;
         asn1Bytes[offset++] = (byte) l;
 
-        System.arraycopy(xmldsigBytes, 2*rawLen - k, asn1Bytes, (offset + l) - k, k);
+        System.arraycopy(xmldsigBytes, 2 * rawLen - k, asn1Bytes, (offset + l) - k, k);
 
         return asn1Bytes;
     }

Modified: webservices/wss4j/branches/swssf/streaming-xml-security/src/main/java/org/swssf/xmlsec/impl/algorithms/PKISignatureAlgorithm.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/swssf/streaming-xml-security/src/main/java/org/swssf/xmlsec/impl/algorithms/PKISignatureAlgorithm.java?rev=1295267&r1=1295266&r2=1295267&view=diff
==============================================================================
--- webservices/wss4j/branches/swssf/streaming-xml-security/src/main/java/org/swssf/xmlsec/impl/algorithms/PKISignatureAlgorithm.java
(original)
+++ webservices/wss4j/branches/swssf/streaming-xml-security/src/main/java/org/swssf/xmlsec/impl/algorithms/PKISignatureAlgorithm.java
Wed Feb 29 20:54:51 2012
@@ -100,7 +100,7 @@ public class PKISignatureAlgorithm imple
             throw new XMLSecurityException(XMLSecurityException.ErrorCode.FAILED_SIGNATURE,
e);
         }
     }
-    
+
     public void engineInitVerify(Key verificationKey) throws XMLSecurityException {
         try {
             signature.initVerify((PublicKey) verificationKey);

Modified: webservices/wss4j/branches/swssf/streaming-xml-security/src/main/java/org/swssf/xmlsec/impl/processor/input/AbstractDecryptInputProcessor.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/swssf/streaming-xml-security/src/main/java/org/swssf/xmlsec/impl/processor/input/AbstractDecryptInputProcessor.java?rev=1295267&r1=1295266&r2=1295267&view=diff
==============================================================================
--- webservices/wss4j/branches/swssf/streaming-xml-security/src/main/java/org/swssf/xmlsec/impl/processor/input/AbstractDecryptInputProcessor.java
(original)
+++ webservices/wss4j/branches/swssf/streaming-xml-security/src/main/java/org/swssf/xmlsec/impl/processor/input/AbstractDecryptInputProcessor.java
Wed Feb 29 20:54:51 2012
@@ -228,7 +228,7 @@ public abstract class AbstractDecryptInp
                     //retrieve the securityToken which must be used for decryption
                     SecurityToken securityToken = SecurityTokenFactory.newInstance().getSecurityToken(
                             keyInfoType, getSecurityProperties().getDecryptionCrypto(),
-                            getSecurityProperties().getCallbackHandler(), inputProcessorChain.getSecurityContext(),
this);
+                            getSecurityProperties().getCallbackHandler(), inputProcessorChain.getSecurityContext());
 
                     handleSecurityToken(securityToken, inputProcessorChain.getSecurityContext(),
encryptedDataType);
                     //only fire here ContentEncryptedElementEvents

Modified: webservices/wss4j/branches/swssf/streaming-xml-security/src/main/java/org/swssf/xmlsec/impl/processor/input/AbstractSignatureInputHandler.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/swssf/streaming-xml-security/src/main/java/org/swssf/xmlsec/impl/processor/input/AbstractSignatureInputHandler.java?rev=1295267&r1=1295266&r2=1295267&view=diff
==============================================================================
--- webservices/wss4j/branches/swssf/streaming-xml-security/src/main/java/org/swssf/xmlsec/impl/processor/input/AbstractSignatureInputHandler.java
(original)
+++ webservices/wss4j/branches/swssf/streaming-xml-security/src/main/java/org/swssf/xmlsec/impl/processor/input/AbstractSignatureInputHandler.java
Wed Feb 29 20:54:51 2012
@@ -137,7 +137,6 @@ public abstract class AbstractSignatureI
     </ds:Signature>
      */
 
-    //todo can this class be made abstract somehow?
     public class SignatureVerifier {
 
         private SignatureType signatureType;
@@ -155,7 +154,7 @@ public abstract class AbstractSignatureI
             KeyInfoType keyInfoType = signatureType.getKeyInfo();
             SecurityToken securityToken = SecurityTokenFactory.newInstance().getSecurityToken(keyInfoType,
                     securityProperties.getSignatureVerificationCrypto(), securityProperties.getCallbackHandler(),
-                    securityContext, this);
+                    securityContext);
             securityToken.verify();
 
             try {

Modified: webservices/wss4j/branches/swssf/streaming-xml-security/src/main/java/org/swssf/xmlsec/impl/processor/output/AbstractSignatureEndingOutputProcessor.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/swssf/streaming-xml-security/src/main/java/org/swssf/xmlsec/impl/processor/output/AbstractSignatureEndingOutputProcessor.java?rev=1295267&r1=1295266&r2=1295267&view=diff
==============================================================================
--- webservices/wss4j/branches/swssf/streaming-xml-security/src/main/java/org/swssf/xmlsec/impl/processor/output/AbstractSignatureEndingOutputProcessor.java
(original)
+++ webservices/wss4j/branches/swssf/streaming-xml-security/src/main/java/org/swssf/xmlsec/impl/processor/output/AbstractSignatureEndingOutputProcessor.java
Wed Feb 29 20:54:51 2012
@@ -111,7 +111,7 @@ public abstract class AbstractSignatureE
         if (wrappingSecurityTokenProvider == null) {
             throw new XMLSecurityException(XMLSecurityException.ErrorCode.FAILED_SIGNATURE);
         }
-        final SecurityToken wrappingSecurityToken = wrappingSecurityTokenProvider.getSecurityToken(null);
+        final SecurityToken wrappingSecurityToken = wrappingSecurityTokenProvider.getSecurityToken();
         if (wrappingSecurityToken == null) {
             throw new XMLSecurityException(XMLSecurityException.ErrorCode.FAILED_SIGNATURE);
         }

Modified: webservices/wss4j/branches/swssf/streaming-xml-security/src/main/java/org/swssf/xmlsec/impl/securityToken/SecurityTokenFactory.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/swssf/streaming-xml-security/src/main/java/org/swssf/xmlsec/impl/securityToken/SecurityTokenFactory.java?rev=1295267&r1=1295266&r2=1295267&view=diff
==============================================================================
--- webservices/wss4j/branches/swssf/streaming-xml-security/src/main/java/org/swssf/xmlsec/impl/securityToken/SecurityTokenFactory.java
(original)
+++ webservices/wss4j/branches/swssf/streaming-xml-security/src/main/java/org/swssf/xmlsec/impl/securityToken/SecurityTokenFactory.java
Wed Feb 29 20:54:51 2012
@@ -35,6 +35,7 @@ import javax.security.auth.callback.Call
  */
 public abstract class SecurityTokenFactory {
 
+    //todo caching?
     public static SecurityTokenFactory newInstance() throws XMLSecurityException {
 
         String stf = ConfigurationProperties.getProperty("securityTokenFactory");
@@ -57,5 +58,5 @@ public abstract class SecurityTokenFacto
 
     public abstract SecurityToken getSecurityToken(KeyInfoType keyInfoType, Crypto crypto,
                                                    final CallbackHandler callbackHandler,
-                                                   SecurityContext securityContext, Object
processor) throws XMLSecurityException;
+                                                   SecurityContext securityContext) throws
XMLSecurityException;
 }

Modified: webservices/wss4j/branches/swssf/streaming-xml-security/src/main/java/org/swssf/xmlsec/impl/securityToken/SecurityTokenFactoryImpl.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/swssf/streaming-xml-security/src/main/java/org/swssf/xmlsec/impl/securityToken/SecurityTokenFactoryImpl.java?rev=1295267&r1=1295266&r2=1295267&view=diff
==============================================================================
--- webservices/wss4j/branches/swssf/streaming-xml-security/src/main/java/org/swssf/xmlsec/impl/securityToken/SecurityTokenFactoryImpl.java
(original)
+++ webservices/wss4j/branches/swssf/streaming-xml-security/src/main/java/org/swssf/xmlsec/impl/securityToken/SecurityTokenFactoryImpl.java
Wed Feb 29 20:54:51 2012
@@ -40,7 +40,7 @@ public class SecurityTokenFactoryImpl ex
     @Override
     public SecurityToken getSecurityToken(KeyInfoType keyInfoType, Crypto crypto,
                                           final CallbackHandler callbackHandler,
-                                          SecurityContext securityContext, Object processor)
throws XMLSecurityException {
+                                          SecurityContext securityContext) throws XMLSecurityException
{
 
         throw new XMLSecurityException(XMLSecurityException.ErrorCode.INVALID_SECURITY, "noKeyinfo");
     }

Modified: webservices/wss4j/branches/swssf/streaming-xml-security/src/test/java/org/swssf/xmlsec/test/Canonicalizer11Test.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/swssf/streaming-xml-security/src/test/java/org/swssf/xmlsec/test/Canonicalizer11Test.java?rev=1295267&r1=1295266&r2=1295267&view=diff
==============================================================================
--- webservices/wss4j/branches/swssf/streaming-xml-security/src/test/java/org/swssf/xmlsec/test/Canonicalizer11Test.java
(original)
+++ webservices/wss4j/branches/swssf/streaming-xml-security/src/test/java/org/swssf/xmlsec/test/Canonicalizer11Test.java
Wed Feb 29 20:54:51 2012
@@ -139,7 +139,6 @@ public class Canonicalizer11Test {
      */
     @Test
     public void test34subtree() throws Exception {
-        //todo enable validation
 
         URL fileIn = this.getClass().getClassLoader().getResource("testdata/c14n/in/34_input_validatingParser.xml");
         URL fileRef = this.getClass().getClassLoader().getResource("testdata/c14n/in/34_c14n_validatingParser.xml");
@@ -154,7 +153,6 @@ public class Canonicalizer11Test {
      */
     @Test
     public void test35subtree() throws Exception {
-        //todo enable validation
 
         URL fileIn = this.getClass().getClassLoader().getResource("testdata/c14n/in/35_input.xml");
         URL fileRef = this.getClass().getClassLoader().getResource("testdata/c14n/in/35_c14n.xml");

Modified: webservices/wss4j/branches/swssf/streaming-xml-security/src/test/java/org/swssf/xmlsec/test/Canonicalizer20010315ExclusiveTest.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/swssf/streaming-xml-security/src/test/java/org/swssf/xmlsec/test/Canonicalizer20010315ExclusiveTest.java?rev=1295267&r1=1295266&r2=1295267&view=diff
==============================================================================
--- webservices/wss4j/branches/swssf/streaming-xml-security/src/test/java/org/swssf/xmlsec/test/Canonicalizer20010315ExclusiveTest.java
(original)
+++ webservices/wss4j/branches/swssf/streaming-xml-security/src/test/java/org/swssf/xmlsec/test/Canonicalizer20010315ExclusiveTest.java
Wed Feb 29 20:54:51 2012
@@ -128,7 +128,7 @@ public class Canonicalizer20010315Exclus
 
         assertTrue(equals);
     }
-    
+
     @Test
     public void test24excl() throws Exception {
 

Modified: webservices/wss4j/branches/swssf/streaming-xml-security/src/test/java/org/swssf/xmlsec/test/Canonicalizer20010315Test.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/swssf/streaming-xml-security/src/test/java/org/swssf/xmlsec/test/Canonicalizer20010315Test.java?rev=1295267&r1=1295266&r2=1295267&view=diff
==============================================================================
--- webservices/wss4j/branches/swssf/streaming-xml-security/src/test/java/org/swssf/xmlsec/test/Canonicalizer20010315Test.java
(original)
+++ webservices/wss4j/branches/swssf/streaming-xml-security/src/test/java/org/swssf/xmlsec/test/Canonicalizer20010315Test.java
Wed Feb 29 20:54:51 2012
@@ -215,7 +215,6 @@ public class Canonicalizer20010315Test {
      */
     @Test
     public void test34subtree() throws Exception {
-        //todo enable validation
         URL fileIn = this.getClass().getClassLoader().getResource("testdata/c14n/in/34_input_validatingParser.xml");
         URL fileRef = this.getClass().getClassLoader().getResource("testdata/c14n/in/34_c14n_validatingParser.xml");
 
@@ -229,7 +228,6 @@ public class Canonicalizer20010315Test {
      */
     @Test
     public void test35subtree() throws Exception {
-        //todo enable validation
 
         URL fileIn = this.getClass().getClassLoader().getResource("testdata/c14n/in/35_input.xml");
         URL fileRef = this.getClass().getClassLoader().getResource("testdata/c14n/in/35_c14n.xml");

Modified: webservices/wss4j/branches/swssf/streaming-xml-security/src/test/java/org/swssf/xmlsec/test/Santuario191Test.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/swssf/streaming-xml-security/src/test/java/org/swssf/xmlsec/test/Santuario191Test.java?rev=1295267&r1=1295266&r2=1295267&view=diff
==============================================================================
--- webservices/wss4j/branches/swssf/streaming-xml-security/src/test/java/org/swssf/xmlsec/test/Santuario191Test.java
(original)
+++ webservices/wss4j/branches/swssf/streaming-xml-security/src/test/java/org/swssf/xmlsec/test/Santuario191Test.java
Wed Feb 29 20:54:51 2012
@@ -34,26 +34,26 @@ import static org.testng.Assert.assertEq
 
 /**
  * This is a test for Santuario-191:
- * 
+ * <p/>
  * https://issues.apache.org/jira/browse/SANTUARIO-191
- *
+ * <p/>
  * An xml:Id attribute is appearing in a child element, contrary to the C14n11 spec.
  */
 public class Santuario191Test {
 
     private static final String INPUT_DATA =
-        "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
-      + "<test xml:id=\"testid1\">"
-      + "<data>"
-      + "    <user1>Alice</user1>"
-      + "    <user2>Bob</user2>"
-      + "</data>"
-      + "</test>";
+            "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
+                    + "<test xml:id=\"testid1\">"
+                    + "<data>"
+                    + "    <user1>Alice</user1>"
+                    + "    <user2>Bob</user2>"
+                    + "</data>"
+                    + "</test>";
     private static final String EXPECTED_RESULT =
-        "<data>"
-      + "    <user1>Alice</user1>"
-      + "    <user2>Bob</user2>"
-      + "</data>";
+            "<data>"
+                    + "    <user1>Alice</user1>"
+                    + "    <user2>Bob</user2>"
+                    + "</data>";
 
     private XMLInputFactory xmlInputFactory;
 
@@ -69,12 +69,12 @@ public class Santuario191Test {
         // Parse the Data
         //
         ByteArrayOutputStream baos = new ByteArrayOutputStream();
-        Canonicalizer11_OmitCommentsTransformer c = 
-            new Canonicalizer11_OmitCommentsTransformer(null, baos);
+        Canonicalizer11_OmitCommentsTransformer c =
+                new Canonicalizer11_OmitCommentsTransformer(null, baos);
         XMLEventReader xmlEventReader = xmlInputFactory.createXMLEventReader(
                 new StringReader(INPUT_DATA)
         );
-        
+
         XMLEvent xmlEvent = null;
         while (xmlEventReader.hasNext()) {
             xmlEvent = xmlEventReader.nextEvent();
@@ -82,7 +82,7 @@ public class Santuario191Test {
                 break;
             }
         }
-        
+
         while (xmlEventReader.hasNext()) {
             c.transform(xmlEvent);
             if (xmlEvent.isEndElement() && xmlEvent.asEndElement().getName().equals(new
QName(null, "data"))) {
@@ -90,8 +90,8 @@ public class Santuario191Test {
             }
             xmlEvent = xmlEventReader.nextEvent();
         }
-        
+
         assertEquals(new String(baos.toByteArray()), EXPECTED_RESULT);
     }
-    
+
 }



Mime
View raw message