You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@santuario.apache.org by co...@apache.org on 2015/12/15 18:13:22 UTC

svn commit: r1720201 [13/24] - in /santuario/xml-security-java/trunk: samples/javax/xml/crypto/dsig/samples/ samples/org/apache/xml/security/samples/ samples/org/apache/xml/security/samples/algorithms/ samples/org/apache/xml/security/samples/canonicali...

Modified: santuario/xml-security-java/trunk/src/test/java/javax/xml/crypto/test/dsig/ValidateSignatureTest.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/test/java/javax/xml/crypto/test/dsig/ValidateSignatureTest.java?rev=1720201&r1=1720200&r2=1720201&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/test/java/javax/xml/crypto/test/dsig/ValidateSignatureTest.java (original)
+++ santuario/xml-security-java/trunk/src/test/java/javax/xml/crypto/test/dsig/ValidateSignatureTest.java Tue Dec 15 17:13:17 2015
@@ -52,14 +52,14 @@ public class ValidateSignatureTest exten
     public ValidateSignatureTest() {
         String fs = System.getProperty("file.separator");
         String base = System.getProperty("basedir") == null ? "./": System.getProperty("basedir");
-        
-        dir = new File(base + fs + "src/test/resources" + fs 
+
+        dir = new File(base + fs + "src/test/resources" + fs
             + "javax" + fs + "xml" + fs + "crypto", "dsig");
         validator = new SignatureValidator(dir);
     }
 
-    /** 
-     * Validates a signature that references an element with an ID attribute. 
+    /**
+     * Validates a signature that references an element with an ID attribute.
      * The element's ID needs to be registered so that it can be found.
      */
     @org.junit.Test
@@ -79,7 +79,7 @@ public class ValidateSignatureTest exten
     public void test_signature_external_c14n_xmlattrs() throws Exception {
         String file = "signature-external-c14n-xmlatrs.xml";
 
-        boolean coreValidity = validator.validate(file, 
+        boolean coreValidity = validator.validate(file,
             new KeySelectors.SecretKeySelector("secret".getBytes("ASCII")));
         assertTrue("Signature failed core validation", coreValidity);
     }
@@ -91,7 +91,7 @@ public class ValidateSignatureTest exten
     public void test_invalid_signature() throws Exception {
         InvalidURIDereferencer ud = new InvalidURIDereferencer();
 
-        boolean coreValidity = validator.validate("invalid-signature.xml", 
+        boolean coreValidity = validator.validate("invalid-signature.xml",
             new KeySelectors.KeyValueKeySelector(), ud);
         assertFalse("Invalid signature should fail!", coreValidity);
         assertTrue("References validated before signature", ud.dereferenced);
@@ -101,7 +101,7 @@ public class ValidateSignatureTest exten
     public void test_signature_enveloping_hmac_sha1_trunclen_0() throws Exception {
         try {
             validator.validate
-                ("signature-enveloping-hmac-sha1-trunclen-0-attack.xml", 
+                ("signature-enveloping-hmac-sha1-trunclen-0-attack.xml",
                 new KeySelectors.SecretKeySelector("secret".getBytes("ASCII")));
             fail("Expected HMACOutputLength exception");
         } catch (XMLSignatureException xse) {
@@ -112,10 +112,10 @@ public class ValidateSignatureTest exten
 
     @org.junit.Test
     public void test_signature_enveloping_hmac_sha1_trunclen_8() throws Exception {
-   
+
         try {
             validator.validate
-                ("signature-enveloping-hmac-sha1-trunclen-8-attack.xml", 
+                ("signature-enveloping-hmac-sha1-trunclen-8-attack.xml",
                 new KeySelectors.SecretKeySelector("secret".getBytes("ASCII")));
             fail("Expected HMACOutputLength exception");
         } catch (XMLSignatureException xse) {
@@ -129,7 +129,7 @@ public class ValidateSignatureTest exten
     @org.junit.Test
     public void test_signature_exclc14n_xmlnamespace() throws Exception {
         String file = "demo.signed.xml";
-        boolean coreValidity = validator.validate(file, 
+        boolean coreValidity = validator.validate(file,
             new KeySelectors.RawX509KeySelector());
         assertTrue("Signature failed core validation", coreValidity);
     }
@@ -161,5 +161,5 @@ public class ValidateSignatureTest exten
             return ud.dereference(ref, ctx);
         }
     }
-    
+
 }

Modified: santuario/xml-security-java/trunk/src/test/java/javax/xml/crypto/test/dsig/X509KeySelector.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/test/java/javax/xml/crypto/test/dsig/X509KeySelector.java?rev=1720201&r1=1720200&r2=1720201&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/test/java/javax/xml/crypto/test/dsig/X509KeySelector.java (original)
+++ santuario/xml-security-java/trunk/src/test/java/javax/xml/crypto/test/dsig/X509KeySelector.java Tue Dec 15 17:13:17 2015
@@ -48,8 +48,8 @@ import org.apache.jcp.xml.dsig.internal.
  *
  * <p>This <code>KeySelector</code> uses the specified <code>KeyStore</code>
  * to find a trusted <code>X509Certificate</code> that matches information
- * specified in the {@link KeyInfo} passed to the {@link #select} method. 
- * The public key from the first match is returned. If no match, 
+ * specified in the {@link KeyInfo} passed to the {@link #select} method.
+ * The public key from the first match is returned. If no match,
  * <code>null</code> is returned. See the <code>select</code> method for more
  * information.
  *
@@ -69,14 +69,14 @@ public class X509KeySelector extends Key
      *
      * @param keyStore the keystore
      * @throws KeyStoreException if the keystore has not been initialized
-     * @throws NullPointerException if <code>keyStore</code> is 
+     * @throws NullPointerException if <code>keyStore</code> is
      *    <code>null</code>
      */
     public X509KeySelector(KeyStore keyStore) throws KeyStoreException {
         this(keyStore, true);
     }
 
-    public X509KeySelector(KeyStore keyStore, boolean trusted) 
+    public X509KeySelector(KeyStore keyStore, boolean trusted)
         throws KeyStoreException {
         if (keyStore == null) {
             throw new NullPointerException("keyStore is null");
@@ -92,22 +92,22 @@ public class X509KeySelector extends Key
      *
      * <p>This method compares data contained in {@link KeyInfo} entries
      * with information stored in the <code>KeyStore</code>. The implementation
-     * iterates over the KeyInfo types and returns the first {@link PublicKey} 
-     * of an X509Certificate in the keystore that is compatible with the 
-     * specified AlgorithmMethod according to the following rules for each 
+     * iterates over the KeyInfo types and returns the first {@link PublicKey}
+     * of an X509Certificate in the keystore that is compatible with the
+     * specified AlgorithmMethod according to the following rules for each
      * keyinfo type:
      *
      * X509Data X509Certificate: if it contains a <code>KeyUsage</code>
-     *   extension that asserts the <code>digitalSignature</code> bit and 
+     *   extension that asserts the <code>digitalSignature</code> bit and
      *   matches an <code>X509Certificate</code> in the <code>KeyStore</code>.
-     * X509Data X509IssuerSerial: if the serial number and issuer DN match an 
+     * X509Data X509IssuerSerial: if the serial number and issuer DN match an
      *    <code>X509Certificate</code> in the <code>KeyStore</code>.
-     * X509Data X509SubjectName: if the subject DN matches an 
+     * X509Data X509SubjectName: if the subject DN matches an
      *    <code>X509Certificate</code> in the <code>KeyStore</code>.
-     * X509Data X509SKI: if the subject key identifier matches an 
+     * X509Data X509SKI: if the subject key identifier matches an
      *    <code>X509Certificate</code> in the <code>KeyStore</code>.
      * KeyName: if the keyname matches an alias in the <code>KeyStore</code>.
-     * RetrievalMethod: supports rawX509Certificate and X509Data types. If 
+     * RetrievalMethod: supports rawX509Certificate and X509Data types. If
      *    rawX509Certificate type, it must match an <code>X509Certificate</code>
      *    in the <code>KeyStore</code>.
      *
@@ -128,7 +128,7 @@ public class X509KeySelector extends Key
      * @throws ClassCastException if the data type of <code>method</code>
      *    is not supported by this key selector
      */
-    public KeySelectorResult select(KeyInfo keyInfo, 
+    public KeySelectorResult select(KeyInfo keyInfo,
         KeySelector.Purpose purpose, AlgorithmMethod method,
         XMLCryptoContext context) throws KeySelectorException {
 
@@ -167,11 +167,11 @@ public class X509KeySelector extends Key
                         KeySelectorResult ksr = null;
                         if (rm.getType().equals
                             (X509Data.RAW_X509_CERTIFICATE_TYPE)) {
-                            OctetStreamData data = (OctetStreamData) 
+                            OctetStreamData data = (OctetStreamData)
                                 rm.dereference(context);
-                            CertificateFactory cf = 
+                            CertificateFactory cf =
                                 CertificateFactory.getInstance("X.509");
-                            X509Certificate cert = (X509Certificate) 
+                            X509Certificate cert = (X509Certificate)
                                 cf.generateCertificate(data.getOctetStream());
                             ksr = certSelect(cert, sm);
                         } else if (rm.getType().equals(X509Data.TYPE)) {
@@ -206,7 +206,7 @@ public class X509KeySelector extends Key
      * @return a KeySelectorResult containing the cert's public key if there
      *   is a match; otherwise null
      */
-    private KeySelectorResult keyStoreSelect(CertSelector cs) 
+    private KeySelectorResult keyStoreSelect(CertSelector cs)
         throws KeyStoreException {
         Enumeration<String> aliases = ks.aliases();
         while (aliases.hasMoreElements()) {
@@ -227,7 +227,7 @@ public class X509KeySelector extends Key
      * @return a KeySelectorResult containing the cert's public key if there
      *   is a match; otherwise null
      */
-    private KeySelectorResult certSelect(X509Certificate xcert, 
+    private KeySelectorResult certSelect(X509Certificate xcert,
         SignatureMethod sm) throws KeyStoreException {
         // skip non-signer certs
         boolean[] keyUsage = xcert.getKeyUsage();
@@ -287,13 +287,13 @@ public class X509KeySelector extends Key
 
     /**
      * Searches the specified keystore for a certificate that matches an
-     * entry of the specified X509Data and contains a public key that is 
+     * entry of the specified X509Data and contains a public key that is
      * compatible with the specified SignatureMethod.
      *
      * @return a KeySelectorResult containing the cert's public key if there
      *   is a match; otherwise null
      */
-    private KeySelectorResult x509DataSelect(X509Data xd, SignatureMethod sm) 
+    private KeySelectorResult x509DataSelect(X509Data xd, SignatureMethod sm)
         throws KeyStoreException, KeySelectorException {
 
         // convert signature algorithm to compatible public-key alg OID

Modified: santuario/xml-security-java/trunk/src/test/java/javax/xml/crypto/test/dsig/XMLObjectTest.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/test/java/javax/xml/crypto/test/dsig/XMLObjectTest.java?rev=1720201&r1=1720200&r2=1720201&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/test/java/javax/xml/crypto/test/dsig/XMLObjectTest.java (original)
+++ santuario/xml-security-java/trunk/src/test/java/javax/xml/crypto/test/dsig/XMLObjectTest.java Tue Dec 15 17:13:17 2015
@@ -42,28 +42,28 @@ public class XMLObjectTest extends org.j
         factory = XMLSignatureFactory.getInstance
             ("DOM", new org.apache.jcp.xml.dsig.internal.dom.XMLDSigRI());
     }
-    
+
     @SuppressWarnings("rawtypes")
     @org.junit.Test
     public void testConstructor() {
-        // test XMLSignatureFactory.newXMLObject(List, String, String, String) 
+        // test XMLSignatureFactory.newXMLObject(List, String, String, String)
         XMLObject obj;
-        
-        obj = factory.newXMLObject(null, null, null, null); 
+
+        obj = factory.newXMLObject(null, null, null, null);
         assertNotNull(obj);
 
         List<XMLStructure> list = new ArrayList<XMLStructure>();
-        obj = factory.newXMLObject(list, null, null, null); 
+        obj = factory.newXMLObject(list, null, null, null);
         assertNotNull(obj);
-        
+
         String strEntry = "wrong type";
         // use raw List type to test for invalid XMLStructure entries
         List invalidList = new ArrayList();
         addEntryToRawList(invalidList, strEntry);
         try {
-            factory.newXMLObject(invalidList, null, null, null); 
+            factory.newXMLObject(invalidList, null, null, null);
             fail("Should raise a CCE for content containing " +
-                 "invalid, i.e. non-XMLStructure, entries"); 
+                 "invalid, i.e. non-XMLStructure, entries");
         } catch (ClassCastException cce) {
         } catch (Exception ex) {
             fail("Should raise a CCE for content with invalid entries " +
@@ -93,8 +93,8 @@ public class XMLObjectTest extends org.j
         list.add(new TestUtils.MyOwnXMLStructure());
         XMLObject obj = factory.newXMLObject(list, id, mimeType, encoding);
         try {
-            obj.isFeatureSupported(null); 
-            fail("Should raise a NPE for null feature"); 
+            obj.isFeatureSupported(null);
+            fail("Should raise a NPE for null feature");
         } catch (NullPointerException npe) {}
 
         assertTrue(!obj.isFeatureSupported("not supported"));

Modified: santuario/xml-security-java/trunk/src/test/java/javax/xml/crypto/test/dsig/XMLSignatureFactoryTest.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/test/java/javax/xml/crypto/test/dsig/XMLSignatureFactoryTest.java?rev=1720201&r1=1720200&r2=1720201&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/test/java/javax/xml/crypto/test/dsig/XMLSignatureFactoryTest.java (original)
+++ santuario/xml-security-java/trunk/src/test/java/javax/xml/crypto/test/dsig/XMLSignatureFactoryTest.java Tue Dec 15 17:13:17 2015
@@ -51,7 +51,7 @@ public class XMLSignatureFactoryTest ext
             (new org.apache.jcp.xml.dsig.internal.dom.XMLDSigRI(), 1);
     }
 
-    public XMLSignatureFactoryTest() throws Exception { 
+    public XMLSignatureFactoryTest() throws Exception {
         factory = XMLSignatureFactory.getInstance
             ("DOM", new org.apache.jcp.xml.dsig.internal.dom.XMLDSigRI());
     }
@@ -65,7 +65,7 @@ public class XMLSignatureFactoryTest ext
 
         try {
             XMLSignatureFactory.getInstance(null);
-            fail("Should raise a NPE for null mechanismType"); 
+            fail("Should raise a NPE for null mechanismType");
         } catch (NullPointerException npe) {}
 
         try {
@@ -75,17 +75,17 @@ public class XMLSignatureFactoryTest ext
         } catch (NoSuchProviderException nspe) {
         } catch (NoSuchMechanismException nse) {
             fail("Should raise a NoSuchProviderException instead of " + nse +
-                 " if specified provider is not found"); 
+                 " if specified provider is not found");
         }
 
         try {
             XMLSignatureFactory.getInstance(null);
-            fail("Should raise a NPE for null mechanismType"); 
+            fail("Should raise a NPE for null mechanismType");
         } catch (NullPointerException npe) {}
 
         try {
             XMLSignatureFactory.getInstance("DOM", (Provider) null);
-            fail("Should raise a NPE for null provider"); 
+            fail("Should raise a NPE for null provider");
         } catch (NullPointerException npe) {}
     }
 
@@ -98,8 +98,8 @@ public class XMLSignatureFactoryTest ext
     @org.junit.Test
     public void testisFeatureSupported() {
         try {
-            factory.isFeatureSupported(null); 
-            fail("Should raise a NPE for null feature"); 
+            factory.isFeatureSupported(null);
+            fail("Should raise a NPE for null feature");
         } catch (NullPointerException npe) {}
 
         assertTrue(!factory.isFeatureSupported("not supported"));
@@ -117,7 +117,7 @@ public class XMLSignatureFactoryTest ext
         XMLSignature stuff;
         try {
             stuff = factory.unmarshalXMLSignature((XMLValidateContext) null);
-            fail("Should raise an NPE for null inputs"); 
+            fail("Should raise an NPE for null inputs");
         } catch (NullPointerException ex) {
         } catch (Exception ex) {
             fail("Should throw an NPE instead of " + ex +
@@ -146,11 +146,11 @@ public class XMLSignatureFactoryTest ext
                     public String getNamespacePrefix
                         (String nsURI, String defPrefix) {return null;}
                     });
-            fail("Should throw a CCE for input of wrong type"); 
+            fail("Should throw a CCE for input of wrong type");
         } catch (ClassCastException ex) {
         } catch (Exception ex) {
             fail("Should raise a CCE instead of " + ex +
-                 " for wrong inputs"); 
+                 " for wrong inputs");
         }
 
         DocumentBuilder docBuilder = XMLUtils.createDocumentBuilder(false, false);
@@ -164,9 +164,9 @@ public class XMLSignatureFactoryTest ext
         try {
             stuff = factory.unmarshalXMLSignature
             (new DOMValidateContext(TestUtils.getPublicKey("RSA"), nl.item(0)));
-            fail("Should throw a MarshalException for non-XMLSignature inputs"); 
+            fail("Should throw a MarshalException for non-XMLSignature inputs");
         } catch (MarshalException ex) {}
-        
+
         nl = doc.getElementsByTagName("Signature");
         try {
             stuff = factory.unmarshalXMLSignature

Modified: santuario/xml-security-java/trunk/src/test/java/javax/xml/crypto/test/dsig/XMLSignatureTest.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/test/java/javax/xml/crypto/test/dsig/XMLSignatureTest.java?rev=1720201&r1=1720200&r2=1720201&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/test/java/javax/xml/crypto/test/dsig/XMLSignatureTest.java (original)
+++ santuario/xml-security-java/trunk/src/test/java/javax/xml/crypto/test/dsig/XMLSignatureTest.java Tue Dec 15 17:13:17 2015
@@ -69,7 +69,7 @@ public class XMLSignatureTest extends or
         kifac = KeyInfoFactory.getInstance
             ("DOM", new org.apache.jcp.xml.dsig.internal.dom.XMLDSigRI());
 
-        // set up the corresponding SignatureMethod 
+        // set up the corresponding SignatureMethod
         SIG_METHODS = new SignatureMethod[3];
         SIG_METHODS[0] = fac.newSignatureMethod(SignatureMethod.DSA_SHA1, null);
         SIG_METHODS[1] = fac.newSignatureMethod(SignatureMethod.RSA_SHA1, null);
@@ -113,7 +113,7 @@ public class XMLSignatureTest extends or
                 fail("Should throw a NPE for null references");
             } catch (NullPointerException npe) {
             } catch (Exception ex) {
-                fail("Should throw a NPE instead of " + ex + 
+                fail("Should throw a NPE instead of " + ex +
                      " for null references");
             }
         }
@@ -125,7 +125,7 @@ public class XMLSignatureTest extends or
             fail("Should throw a CCE for invalid objects");
         } catch (ClassCastException cce) {
         } catch (Exception ex) {
-            fail("Should throw a CCE instead of " + ex + 
+            fail("Should throw a CCE instead of " + ex +
                  " for invalid objects");
         }
         sig = fac.newXMLSignature(defSi, defKi, objs, id, sigValueId);
@@ -144,17 +144,17 @@ public class XMLSignatureTest extends or
         assertNull(sig.getSignatureValue().getId());
         assertEquals(sig.getSignedInfo(), defSi);
     }
-    
+
     @org.junit.Test
     public void testisFeatureSupported() throws Exception {
 
         XMLSignature sig = fac.newXMLSignature(defSi, null);
-        
+
         try {
-            sig.isFeatureSupported(null); 
-            fail("Should raise a NPE for null feature"); 
+            sig.isFeatureSupported(null);
+            fail("Should raise a NPE for null feature");
         } catch (NullPointerException npe) {}
-            
+
         assertTrue(!sig.isFeatureSupported("not supported"));
     }
 
@@ -175,7 +175,7 @@ public class XMLSignatureTest extends or
                 ki = kifac.newKeyInfo(Collections.singletonList
                     (kifac.newKeyName("testuser")));
             }
-            sig = fac.newXMLSignature(si, ki, objs, id, sigValueId); 
+            sig = fac.newXMLSignature(si, ki, objs, id, sigValueId);
             Document doc = TestUtils.newDocument();
             signContext = new DOMSignContext(SIGN_KEYS[i], doc);
             signContext.setURIDereferencer(ud);
@@ -208,7 +208,7 @@ public class XMLSignatureTest extends or
                 ki = kifac.newKeyInfo(Collections.singletonList
                     (kifac.newKeyName("testuser")));
             }
-            sig = fac.newXMLSignature(si, ki, objs, id, sigValueId); 
+            sig = fac.newXMLSignature(si, ki, objs, id, sigValueId);
             Document doc = TestUtils.newDocument();
             signContext = new DOMSignContext(SIGN_KEYS[i], doc);
             signContext.setProperty
@@ -220,7 +220,7 @@ public class XMLSignatureTest extends or
                 fail("Should have failed because TestProvider does not " +
                      "support " + SIGN_KEYS[i].getAlgorithm());
             } catch (Exception e) {
-                assertTrue(e.getMessage(), 
+                assertTrue(e.getMessage(),
                     e.getCause() instanceof NoSuchAlgorithmException);
             }
         }
@@ -231,7 +231,7 @@ public class XMLSignatureTest extends or
         SignedInfo si = createSignedInfo(SIG_METHODS[1]);
         KeyInfo	ki = kifac.newKeyInfo(Collections.singletonList
                     (kifac.newKeyValue((PublicKey) VALIDATE_KEYS[1])));
-        XMLSignature sig = fac.newXMLSignature(si, ki, objs, id, sigValueId); 
+        XMLSignature sig = fac.newXMLSignature(si, ki, objs, id, sigValueId);
         Document doc = TestUtils.newDocument();
         XMLSignContext signContext = new DOMSignContext(SIGN_KEYS[1], doc);
         signContext.putNamespacePrefix(XMLSignature.XMLNS, "");
@@ -306,7 +306,7 @@ public class XMLSignatureTest extends or
     public void testSignTemplateWithObjectNSDefs() throws Exception {
         String base = System.getProperty("basedir") == null ? "./"
                       : System.getProperty("basedir");
- 
+
         File f = new File(base + "/src/test/resources/javax/xml/crypto/dsig/" +
             "signature-enveloping-rsa-template.xml");
 
@@ -386,7 +386,7 @@ public class XMLSignatureTest extends or
         SignedInfo si = createSignedInfo(sm);
         KeyInfo ki = kifac.newKeyInfo(Collections.singletonList
             (kifac.newKeyValue((PublicKey)TestUtils.getPublicKey("DSA", 2048))));
-        XMLSignature sig = fac.newXMLSignature(si, ki, objs, id, sigValueId); 
+        XMLSignature sig = fac.newXMLSignature(si, ki, objs, id, sigValueId);
         Document doc = TestUtils.newDocument();
         XMLSignContext signContext =
             new DOMSignContext(TestUtils.getPrivateKey("DSA", 2048), doc);
@@ -401,7 +401,7 @@ public class XMLSignatureTest extends or
     private SignedInfo createSignedInfo(SignatureMethod sm) throws Exception {
         // set up the building blocks
         CanonicalizationMethod cm = fac.newCanonicalizationMethod
-            (CanonicalizationMethod.INCLUSIVE_WITH_COMMENTS, 
+            (CanonicalizationMethod.INCLUSIVE_WITH_COMMENTS,
              (C14NMethodParameterSpec) null);
         DigestMethod dm = fac.newDigestMethod(DigestMethod.SHA1, null);
         List<Reference> refs = Collections.singletonList(fac.newReference

Modified: santuario/xml-security-java/trunk/src/test/java/javax/xml/crypto/test/dsig/dom/DOMValidateContextTest.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/test/java/javax/xml/crypto/test/dsig/dom/DOMValidateContextTest.java?rev=1720201&r1=1720200&r2=1720201&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/test/java/javax/xml/crypto/test/dsig/dom/DOMValidateContextTest.java (original)
+++ santuario/xml-security-java/trunk/src/test/java/javax/xml/crypto/test/dsig/dom/DOMValidateContextTest.java Tue Dec 15 17:13:17 2015
@@ -90,5 +90,5 @@ public class DOMValidateContextTest exte
         }
         assertNotNull(domVC.getNode());
     }
-    
+
 }

Modified: santuario/xml-security-java/trunk/src/test/java/javax/xml/crypto/test/dsig/keyinfo/KeyInfoFactoryTest.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/test/java/javax/xml/crypto/test/dsig/keyinfo/KeyInfoFactoryTest.java?rev=1720201&r1=1720200&r2=1720201&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/test/java/javax/xml/crypto/test/dsig/keyinfo/KeyInfoFactoryTest.java (original)
+++ santuario/xml-security-java/trunk/src/test/java/javax/xml/crypto/test/dsig/keyinfo/KeyInfoFactoryTest.java Tue Dec 15 17:13:17 2015
@@ -38,7 +38,7 @@ public class KeyInfoFactoryTest extends
 
     KeyInfoFactory factory;
 
-    public KeyInfoFactoryTest() throws Exception { 
+    public KeyInfoFactoryTest() throws Exception {
         factory = KeyInfoFactory.getInstance
             ("DOM", new org.apache.jcp.xml.dsig.internal.dom.XMLDSigRI());
     }
@@ -52,7 +52,7 @@ public class KeyInfoFactoryTest extends
 
         try {
             KeyInfoFactory.getInstance(null);
-            fail("Should raise a NPE for null xmltype"); 
+            fail("Should raise a NPE for null xmltype");
         } catch (NullPointerException npe) {}
     }
 
@@ -61,12 +61,12 @@ public class KeyInfoFactoryTest extends
         assertNotNull(factory);
         assertEquals("DOM", factory.getMechanismType());
     }
-    
+
     @org.junit.Test
     public void testisFeatureSupported() {
         try {
-            factory.isFeatureSupported(null); 
-            fail("Should raise a NPE for null feature"); 
+            factory.isFeatureSupported(null);
+            fail("Should raise a NPE for null feature");
         } catch (NullPointerException npe) {}
 
         assertTrue(!factory.isFeatureSupported("not supported"));
@@ -80,8 +80,8 @@ public class KeyInfoFactoryTest extends
             (Collections.singletonList(factory.newKeyName("foo")), id);
         assertEquals(id, ki.getId());
         try {
-            ki = factory.newKeyInfo(null, id); 
-            fail("Should raise a NPE for null key info types"); 
+            ki = factory.newKeyInfo(null, id);
+            fail("Should raise a NPE for null key info types");
         } catch (NullPointerException npe) {}
     }
 
@@ -91,8 +91,8 @@ public class KeyInfoFactoryTest extends
         KeyName kn = factory.newKeyName(name);
         assertEquals(name, kn.getName());
         try {
-            kn = factory.newKeyName(null); 
-            fail("Should raise a NPE for null key name"); 
+            kn = factory.newKeyName(null);
+            fail("Should raise a NPE for null key name");
         } catch (NullPointerException npe) {}
     }
 
@@ -101,7 +101,7 @@ public class KeyInfoFactoryTest extends
         // test newKeyValue(PublicKey pk)
         PublicKey myPubKey = new PublicKey() {
             private static final long serialVersionUID = 2756606866185189114L;
-            
+
                 public byte[] getEncoded() {
                     return new byte[20];
                 }
@@ -117,20 +117,20 @@ public class KeyInfoFactoryTest extends
             assertEquals(myPubKey, kv.getPublicKey());
             fail("Should throw a KeyException");
         } catch (KeyException ke) { }
-  
+
         try {
             factory.newKeyValue(null);
-            fail("Should raise a NPE for null key"); 
+            fail("Should raise a NPE for null key");
         } catch (KeyException ke) {
-            fail("Should raise a NPE for null key"); 
+            fail("Should raise a NPE for null key");
         } catch (NullPointerException npe) {}
     }
 
     @org.junit.Test
     public void testnewPGPKeyId() {
-        byte[] valid_id = { 
+        byte[] valid_id = {
             0x01, 0x02, 0x03, 0x04,
-            0x05, 0x06, 0x07, 0x08 
+            0x05, 0x06, 0x07, 0x08
         };
         byte[] invalid_id = {
             0x01, 0x02, 0x03, 0x04,
@@ -182,20 +182,20 @@ public class KeyInfoFactoryTest extends
         assertEquals(uri, rm.getURI());
 
         try {
-            rm = factory.newRetrievalMethod(null); 
-            fail("Should raise a NPE for null URI"); 
+            rm = factory.newRetrievalMethod(null);
+            fail("Should raise a NPE for null URI");
         } catch (NullPointerException npe) {}
 
         // test RetrievalMethod(String, String, List)	
         try {
-            rm = factory.newRetrievalMethod(null, null, null); 
-            fail("Should raise a NPE for null URI"); 
+            rm = factory.newRetrievalMethod(null, null, null);
+            fail("Should raise a NPE for null URI");
         } catch (NullPointerException npe) {}
-        
+
         String type = "http://www.w3.org/2000/09/xmldsig#X509Data";
         try {
-            rm = factory.newRetrievalMethod(null, type, null); 
-            fail("Should raise a NPE for null URI"); 
+            rm = factory.newRetrievalMethod(null, type, null);
+            fail("Should raise a NPE for null URI");
         } catch (NullPointerException npe) {}
 
         rm = factory.newRetrievalMethod(uri, type, null);
@@ -206,7 +206,7 @@ public class KeyInfoFactoryTest extends
     @org.junit.Test
     public void testnewX509Data() {
         // test newX509Data(List)
-        X509Data x509 = 
+        X509Data x509 =
             factory.newX509Data(Collections.singletonList("cn=foo"));
         assertNotNull(x509);
     }
@@ -215,36 +215,36 @@ public class KeyInfoFactoryTest extends
     public void testnewX509IssuerSerial() {
         String name = "CN=valeriep";
         // test newX509IssuerSerial(String, BigInteger)
-        X509IssuerSerial x509is = factory.newX509IssuerSerial(name, 
+        X509IssuerSerial x509is = factory.newX509IssuerSerial(name,
                                                               BigInteger.ONE);
         assertEquals(name, x509is.getIssuerName());
         assertEquals(BigInteger.ONE, x509is.getSerialNumber());
         try {
             x509is = factory.newX509IssuerSerial(null, BigInteger.ZERO);
-            fail("Should raise an NPE for null issuer names"); 
+            fail("Should raise an NPE for null issuer names");
         } catch (NullPointerException ex) {
         } catch (IllegalArgumentException ex2) {
             fail("Should throw NPE instead of IAE for null issuer names");
         }
         try {
             x509is = factory.newX509IssuerSerial(name, null);
-            fail("Should raise an NPE for null serial numbers"); 
+            fail("Should raise an NPE for null serial numbers");
         } catch (NullPointerException ex) {
         } catch (IllegalArgumentException ex2) {
             fail("Should throw NPE instead of IAE for null serial numbers");
         }
         try {
             x509is = factory.newX509IssuerSerial(null, null);
-            fail("Should raise an NPE for null issuer names/serial numbers"); 
+            fail("Should raise an NPE for null issuer names/serial numbers");
         } catch (NullPointerException ex) {
         } catch (IllegalArgumentException ex2) {
-            fail("Should throw NPE instead of IAE for null issuer " + 
+            fail("Should throw NPE instead of IAE for null issuer " +
                  "names/serial numbers");
         }
         try {
             x509is = factory.newX509IssuerSerial("valeriep", BigInteger.ZERO);
-            fail("Should throw IAE for invalid issuer names"); 
+            fail("Should throw IAE for invalid issuer names");
         } catch (IllegalArgumentException ex) {}
     }
-    
+
 }

Modified: santuario/xml-security-java/trunk/src/test/java/javax/xml/crypto/test/dsig/keyinfo/KeyInfoTest.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/test/java/javax/xml/crypto/test/dsig/keyinfo/KeyInfoTest.java?rev=1720201&r1=1720200&r2=1720201&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/test/java/javax/xml/crypto/test/dsig/keyinfo/KeyInfoTest.java (original)
+++ santuario/xml-security-java/trunk/src/test/java/javax/xml/crypto/test/dsig/keyinfo/KeyInfoTest.java Tue Dec 15 17:13:17 2015
@@ -41,7 +41,7 @@ public class KeyInfoTest extends org.jun
 
     private KeyInfoFactory fac;
 
-    public KeyInfoTest() throws Exception { 
+    public KeyInfoTest() throws Exception {
         fac = KeyInfoFactory.getInstance
             ("DOM", new org.apache.jcp.xml.dsig.internal.dom.XMLDSigRI());
     }
@@ -82,8 +82,8 @@ public class KeyInfoTest extends org.jun
             (Collections.singletonList(fac.newKeyName("foo")), id);
         assertEquals(id, ki.getId());
         try {
-            ki = fac.newKeyInfo(null, id); 
-            fail("Should raise a NullPointerException"); 
+            ki = fac.newKeyInfo(null, id);
+            fail("Should raise a NullPointerException");
         } catch (NullPointerException npe) {}
         // test newKeyInfo(List)
         ki = fac.newKeyInfo(Collections.singletonList(fac.newKeyName("foo")));
@@ -94,8 +94,8 @@ public class KeyInfoTest extends org.jun
         KeyInfo ki = fac.newKeyInfo
             (Collections.singletonList(fac.newKeyName("foo")), "keyid");
         try {
-            ki.isFeatureSupported(null); 
-            fail("Should raise a NPE for null feature"); 
+            ki.isFeatureSupported(null);
+            fail("Should raise a NPE for null feature");
         } catch (NullPointerException npe) {}
 
         assertTrue(!ki.isFeatureSupported("not supported"));

Modified: santuario/xml-security-java/trunk/src/test/java/javax/xml/crypto/test/dsig/keyinfo/KeyNameTest.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/test/java/javax/xml/crypto/test/dsig/keyinfo/KeyNameTest.java?rev=1720201&r1=1720200&r2=1720201&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/test/java/javax/xml/crypto/test/dsig/keyinfo/KeyNameTest.java (original)
+++ santuario/xml-security-java/trunk/src/test/java/javax/xml/crypto/test/dsig/keyinfo/KeyNameTest.java Tue Dec 15 17:13:17 2015
@@ -32,7 +32,7 @@ public class KeyNameTest extends org.jun
 
     private KeyInfoFactory fac;
 
-    public KeyNameTest() throws Exception { 
+    public KeyNameTest() throws Exception {
         fac = KeyInfoFactory.getInstance
             ("DOM", new org.apache.jcp.xml.dsig.internal.dom.XMLDSigRI());
     }
@@ -49,8 +49,8 @@ public class KeyNameTest extends org.jun
         KeyName kn = fac.newKeyName(name);
         assertEquals(name, kn.getName());
         try {
-            kn = fac.newKeyName(null); 
-            fail("Should raise a NullPointerException"); 
+            kn = fac.newKeyName(null);
+            fail("Should raise a NullPointerException");
         } catch (NullPointerException npe) {}
     }
 
@@ -58,8 +58,8 @@ public class KeyNameTest extends org.jun
     public void testisFeatureSupported() {
         KeyName kn = fac.newKeyName("keyName");
         try {
-            kn.isFeatureSupported(null); 
-            fail("Should raise a NPE for null feature"); 
+            kn.isFeatureSupported(null);
+            fail("Should raise a NPE for null feature");
         } catch (NullPointerException npe) {}
 
         assertTrue(!kn.isFeatureSupported("not supported"));

Modified: santuario/xml-security-java/trunk/src/test/java/javax/xml/crypto/test/dsig/keyinfo/KeyValueTest.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/test/java/javax/xml/crypto/test/dsig/keyinfo/KeyValueTest.java?rev=1720201&r1=1720200&r2=1720201&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/test/java/javax/xml/crypto/test/dsig/keyinfo/KeyValueTest.java (original)
+++ santuario/xml-security-java/trunk/src/test/java/javax/xml/crypto/test/dsig/keyinfo/KeyValueTest.java Tue Dec 15 17:13:17 2015
@@ -35,7 +35,7 @@ public class KeyValueTest extends org.ju
     private KeyInfoFactory fac;
     private PublicKey keys[] = null;
 
-    public KeyValueTest() throws Exception { 
+    public KeyValueTest() throws Exception {
         fac = KeyInfoFactory.getInstance
             ("DOM", new org.apache.jcp.xml.dsig.internal.dom.XMLDSigRI());
         // generate PublicKey(s) and XMLStructure(s) for DSA and RSA
@@ -74,18 +74,18 @@ public class KeyValueTest extends org.ju
         KeyValue kv = null;
         try {
             kv = fac.newKeyValue(keys[0]);
-            kv.isFeatureSupported(null); 
-            fail("Should raise a NPE for null feature"); 
+            kv.isFeatureSupported(null);
+            fail("Should raise a NPE for null feature");
         } catch (KeyException ke) {
-            fail("Should raise a NPE for null feature"); 
+            fail("Should raise a NPE for null feature");
         } catch (NullPointerException npe) {}
-            
+
         assertTrue(!kv.isFeatureSupported("not supported"));
     }
-    
+
     private PublicKey genPublicKey(String algo, int keysize) throws Exception {
         KeyPairGenerator kpg = KeyPairGenerator.getInstance(algo);
-        kpg.initialize(keysize, new SecureRandom(("Not so random bytes" 
+        kpg.initialize(keysize, new SecureRandom(("Not so random bytes"
             + System.currentTimeMillis() ).getBytes() ));
         KeyPair kp = kpg.generateKeyPair();
         return kp.getPublic();

Modified: santuario/xml-security-java/trunk/src/test/java/javax/xml/crypto/test/dsig/keyinfo/PGPDataTest.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/test/java/javax/xml/crypto/test/dsig/keyinfo/PGPDataTest.java?rev=1720201&r1=1720200&r2=1720201&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/test/java/javax/xml/crypto/test/dsig/keyinfo/PGPDataTest.java (original)
+++ santuario/xml-security-java/trunk/src/test/java/javax/xml/crypto/test/dsig/keyinfo/PGPDataTest.java Tue Dec 15 17:13:17 2015
@@ -35,7 +35,7 @@ import javax.xml.crypto.dsig.keyinfo.*;
 public class PGPDataTest extends org.junit.Assert {
 
     private KeyInfoFactory fac;
-    private byte[][] values = { 
+    private byte[][] values = {
         {
             0x01, 0x02, 0x03, 0x04,
             0x05, 0x06, 0x07, 0x08
@@ -45,7 +45,7 @@ public class PGPDataTest extends org.jun
         }
     };
 
-    public PGPDataTest() throws Exception { 
+    public PGPDataTest() throws Exception {
         fac = KeyInfoFactory.getInstance
             ("DOM", new org.apache.jcp.xml.dsig.internal.dom.XMLDSigRI());
     }
@@ -69,7 +69,7 @@ public class PGPDataTest extends org.jun
                         fail("PGP element has the wrong type");
                     }
                 }
-            } 
+            }
         }
         try {
             // use raw List type to test for invalid entries
@@ -110,7 +110,7 @@ public class PGPDataTest extends org.jun
         pd = fac.newPGPData(values[0], values[1], null);
         assertTrue(Arrays.equals(values[0], pd.getKeyId()));
         assertTrue(Arrays.equals(values[1], pd.getKeyPacket()));
-            
+
         // test newPGPData(byte[], List)
         pd = fac.newPGPData(values[1], null);
         assertTrue(Arrays.equals(values[1], pd.getKeyPacket()));
@@ -131,10 +131,10 @@ public class PGPDataTest extends org.jun
                 pd = fac.newPGPData(values[1], null);
             }
             try {
-                pd.isFeatureSupported(null); 
-                fail("Should raise a NPE for null feature"); 
+                pd.isFeatureSupported(null);
+                fail("Should raise a NPE for null feature");
             } catch (NullPointerException npe) {}
-            
+
             assertTrue(!pd.isFeatureSupported("not supported"));
         }
     }

Modified: santuario/xml-security-java/trunk/src/test/java/javax/xml/crypto/test/dsig/keyinfo/RetrievalMethodTest.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/test/java/javax/xml/crypto/test/dsig/keyinfo/RetrievalMethodTest.java?rev=1720201&r1=1720200&r2=1720201&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/test/java/javax/xml/crypto/test/dsig/keyinfo/RetrievalMethodTest.java (original)
+++ santuario/xml-security-java/trunk/src/test/java/javax/xml/crypto/test/dsig/keyinfo/RetrievalMethodTest.java Tue Dec 15 17:13:17 2015
@@ -32,7 +32,7 @@ public class RetrievalMethodTest extends
 
     private KeyInfoFactory fac;
 
-    public RetrievalMethodTest() throws Exception { 
+    public RetrievalMethodTest() throws Exception {
         fac = KeyInfoFactory.getInstance
             ("DOM", new org.apache.jcp.xml.dsig.internal.dom.XMLDSigRI());
     }
@@ -63,14 +63,14 @@ public class RetrievalMethodTest extends
         assertEquals(uri, rm.getURI());
 
         try {
-            rm = fac.newRetrievalMethod(null); 
-            fail("Should raise a NullPointerException"); 
+            rm = fac.newRetrievalMethod(null);
+            fail("Should raise a NullPointerException");
         } catch (NullPointerException npe) {}
 
         // test RetrievalMethod(String, String, Transform[])
         try {
-            rm = fac.newRetrievalMethod(null, null, null); 
-            fail("Should raise a NullPointerException"); 
+            rm = fac.newRetrievalMethod(null, null, null);
+            fail("Should raise a NullPointerException");
         } catch (NullPointerException npe) {}
 
         final String type = "http://www.w3.org/2000/09/xmldsig#X509Data";
@@ -94,10 +94,10 @@ public class RetrievalMethodTest extends
                 break;
             }		
             try {
-                rm.isFeatureSupported(null); 
-                fail("Should raise a NPE for null feature"); 
+                rm.isFeatureSupported(null);
+                fail("Should raise a NPE for null feature");
             } catch (NullPointerException npe) {}
-            
+
             assertTrue(!rm.isFeatureSupported("not supported"));
         }
     }

Modified: santuario/xml-security-java/trunk/src/test/java/javax/xml/crypto/test/dsig/keyinfo/X509DataTest.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/test/java/javax/xml/crypto/test/dsig/keyinfo/X509DataTest.java?rev=1720201&r1=1720200&r2=1720201&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/test/java/javax/xml/crypto/test/dsig/keyinfo/X509DataTest.java (original)
+++ santuario/xml-security-java/trunk/src/test/java/javax/xml/crypto/test/dsig/keyinfo/X509DataTest.java Tue Dec 15 17:13:17 2015
@@ -37,7 +37,7 @@ public class X509DataTest extends org.ju
 
     private KeyInfoFactory fac;
 
-    public X509DataTest() throws Exception { 
+    public X509DataTest() throws Exception {
         fac = KeyInfoFactory.getInstance
             ("DOM", new org.apache.jcp.xml.dsig.internal.dom.XMLDSigRI());
     }
@@ -73,10 +73,10 @@ public class X509DataTest extends org.ju
 
         X509Data x509 = fac.newX509Data(Collections.singletonList("cn=foo"));
         try {
-            x509.isFeatureSupported(null); 
-            fail("Should raise a NPE for null feature"); 
+            x509.isFeatureSupported(null);
+            fail("Should raise a NPE for null feature");
         } catch (NullPointerException npe) {}
-        
+
         assertTrue(!x509.isFeatureSupported("not supported"));
     }
 }

Modified: santuario/xml-security-java/trunk/src/test/java/javax/xml/crypto/test/dsig/keyinfo/X509IssuerSerialTest.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/test/java/javax/xml/crypto/test/dsig/keyinfo/X509IssuerSerialTest.java?rev=1720201&r1=1720200&r2=1720201&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/test/java/javax/xml/crypto/test/dsig/keyinfo/X509IssuerSerialTest.java (original)
+++ santuario/xml-security-java/trunk/src/test/java/javax/xml/crypto/test/dsig/keyinfo/X509IssuerSerialTest.java Tue Dec 15 17:13:17 2015
@@ -35,7 +35,7 @@ public class X509IssuerSerialTest extend
     private KeyInfoFactory fac;
     private String name;
 
-    public X509IssuerSerialTest() throws Exception { 
+    public X509IssuerSerialTest() throws Exception {
         fac = KeyInfoFactory.getInstance
             ("DOM", new org.apache.jcp.xml.dsig.internal.dom.XMLDSigRI());
         name = "CN = Wolfgang";
@@ -72,7 +72,7 @@ public class X509IssuerSerialTest extend
         try {
             fac.newX509IssuerSerial(badName,BigInteger.ONE);
             fail("Should raise an IllegalArgumentException when issuer " +
-                "distinguished name does not conform to RFC 2253"); 
+                "distinguished name does not conform to RFC 2253");
         } catch (IllegalArgumentException e) {
             // success
         }
@@ -80,13 +80,13 @@ public class X509IssuerSerialTest extend
 
     @org.junit.Test
     public void testisFeatureSupported() {
-        
+
         X509IssuerSerial x509is = fac.newX509IssuerSerial(name, BigInteger.ONE);
         try {
-            x509is.isFeatureSupported(null); 
-            fail("Should raise a NPE for null feature"); 
+            x509is.isFeatureSupported(null);
+            fail("Should raise a NPE for null feature");
         } catch (NullPointerException npe) {}
-        
+
         assertTrue(!x509is.isFeatureSupported("not supported"));
     }
 }

Modified: santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/DSNamespaceContext.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/DSNamespaceContext.java?rev=1720201&r1=1720200&r2=1720201&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/DSNamespaceContext.java (original)
+++ santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/DSNamespaceContext.java Tue Dec 15 17:13:17 2015
@@ -28,15 +28,15 @@ import javax.xml.namespace.NamespaceCont
  * A NamespaceContext implementation for digital signatures
  */
 public class DSNamespaceContext implements NamespaceContext {
-    
-    private Map<String, String> namespaceMap = 
+
+    private Map<String, String> namespaceMap =
         new HashMap<String, String>();
-    
+
     public DSNamespaceContext() {
         namespaceMap.put("ds", "http://www.w3.org/2000/09/xmldsig#");
         namespaceMap.put("dsig", "http://www.w3.org/2000/09/xmldsig#");
     }
-    
+
     public DSNamespaceContext(Map<String, String> namespaces) {
         this();
         namespaceMap.putAll(namespaces);
@@ -45,7 +45,7 @@ public class DSNamespaceContext implemen
     public String getNamespaceURI(String arg0) {
         return namespaceMap.get(arg0);
     }
-    
+
     public void putPrefix(String prefix, String namespace) {
         namespaceMap.put(prefix, namespace);
     }

Modified: santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/algorithms/DigestAlgorithmTest.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/algorithms/DigestAlgorithmTest.java?rev=1720201&r1=1720200&r2=1720201&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/algorithms/DigestAlgorithmTest.java (original)
+++ santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/algorithms/DigestAlgorithmTest.java Tue Dec 15 17:13:17 2015
@@ -36,10 +36,10 @@ public class DigestAlgorithmTest extends
     static {
         org.apache.xml.security.Init.init();
     }
-    
+
     public DigestAlgorithmTest() throws Exception {
         //
-        // If the BouncyCastle provider is not installed, then try to load it 
+        // If the BouncyCastle provider is not installed, then try to load it
         // via reflection.
         //
         if (Security.getProvider("BC") == null) {
@@ -65,111 +65,111 @@ public class DigestAlgorithmTest extends
     @org.junit.Test
     public void testSHA1() throws Exception {
         Document doc = XMLUtils.createDocumentBuilder(false).newDocument();
-        
-        MessageDigestAlgorithm digestAlgorithm = 
+
+        MessageDigestAlgorithm digestAlgorithm =
             MessageDigestAlgorithm.getInstance(doc, MessageDigestAlgorithm.ALGO_ID_DIGEST_SHA1);
         assertEquals(MessageDigestAlgorithm.ALGO_ID_DIGEST_SHA1, digestAlgorithm.getAlgorithmURI());
-        
+
         byte[] digest = digestAlgorithm.digest("test-string".getBytes());
         assertNotNull(digest);
         assertTrue(digest.length > 0);
-        
+
         // Now compare against a JDK MessageDigest Object
         MessageDigest md = MessageDigest.getInstance("SHA-1");
         byte[] digest2 = md.digest("test-string".getBytes());
         assertTrue(Arrays.equals(digest, digest2));
     }
-    
+
     @org.junit.Test
     public void testSHA224() throws Exception {
         Document doc = XMLUtils.createDocumentBuilder(false).newDocument();
-        
-        MessageDigestAlgorithm digestAlgorithm = 
+
+        MessageDigestAlgorithm digestAlgorithm =
             MessageDigestAlgorithm.getInstance(doc, MessageDigestAlgorithm.ALGO_ID_DIGEST_SHA224);
         assertEquals(MessageDigestAlgorithm.ALGO_ID_DIGEST_SHA224, digestAlgorithm.getAlgorithmURI());
-        
+
         byte[] digest = digestAlgorithm.digest("test-string".getBytes());
         assertNotNull(digest);
         assertTrue(digest.length > 0);
-        
+
         // Now compare against a JDK MessageDigest Object
         MessageDigest md = MessageDigest.getInstance("SHA-224");
         byte[] digest2 = md.digest("test-string".getBytes());
         assertTrue(Arrays.equals(digest, digest2));
     }
-    
+
     @org.junit.Test
     public void testSHA256() throws Exception {
         Document doc = XMLUtils.createDocumentBuilder(false).newDocument();
-        
-        MessageDigestAlgorithm digestAlgorithm = 
+
+        MessageDigestAlgorithm digestAlgorithm =
             MessageDigestAlgorithm.getInstance(doc, MessageDigestAlgorithm.ALGO_ID_DIGEST_SHA256);
         assertEquals(MessageDigestAlgorithm.ALGO_ID_DIGEST_SHA256, digestAlgorithm.getAlgorithmURI());
-        
+
         byte[] digest = digestAlgorithm.digest("test-string".getBytes());
         assertNotNull(digest);
         assertTrue(digest.length > 0);
-        
+
         // Now compare against a JDK MessageDigest Object
         MessageDigest md = MessageDigest.getInstance("SHA-256");
         byte[] digest2 = md.digest("test-string".getBytes());
         assertTrue(Arrays.equals(digest, digest2));
     }
-    
+
     @org.junit.Test
     public void testSHA384() throws Exception {
         Document doc = XMLUtils.createDocumentBuilder(false).newDocument();
-        
-        MessageDigestAlgorithm digestAlgorithm = 
+
+        MessageDigestAlgorithm digestAlgorithm =
             MessageDigestAlgorithm.getInstance(doc, MessageDigestAlgorithm.ALGO_ID_DIGEST_SHA384);
         assertEquals(MessageDigestAlgorithm.ALGO_ID_DIGEST_SHA384, digestAlgorithm.getAlgorithmURI());
-        
+
         byte[] digest = digestAlgorithm.digest("test-string".getBytes());
         assertNotNull(digest);
         assertTrue(digest.length > 0);
-        
+
         // Now compare against a JDK MessageDigest Object
         MessageDigest md = MessageDigest.getInstance("SHA-384");
         byte[] digest2 = md.digest("test-string".getBytes());
         assertTrue(Arrays.equals(digest, digest2));
     }
-    
+
     @org.junit.Test
     public void testSHA512() throws Exception {
         Document doc = XMLUtils.createDocumentBuilder(false).newDocument();
-        
-        MessageDigestAlgorithm digestAlgorithm = 
+
+        MessageDigestAlgorithm digestAlgorithm =
             MessageDigestAlgorithm.getInstance(doc, MessageDigestAlgorithm.ALGO_ID_DIGEST_SHA512);
         assertEquals(MessageDigestAlgorithm.ALGO_ID_DIGEST_SHA512, digestAlgorithm.getAlgorithmURI());
-        
+
         byte[] digest = digestAlgorithm.digest("test-string".getBytes());
         assertNotNull(digest);
         assertTrue(digest.length > 0);
-        
+
         // Now compare against a JDK MessageDigest Object
         MessageDigest md = MessageDigest.getInstance("SHA-512");
         byte[] digest2 = md.digest("test-string".getBytes());
         assertTrue(Arrays.equals(digest, digest2));
     }
-    
+
     @org.junit.Test
     public void testMD5() throws Exception {
         Document doc = XMLUtils.createDocumentBuilder(false).newDocument();
-        
-        MessageDigestAlgorithm digestAlgorithm = 
+
+        MessageDigestAlgorithm digestAlgorithm =
             MessageDigestAlgorithm.getInstance(doc, MessageDigestAlgorithm.ALGO_ID_DIGEST_NOT_RECOMMENDED_MD5);
         assertEquals(MessageDigestAlgorithm.ALGO_ID_DIGEST_NOT_RECOMMENDED_MD5, digestAlgorithm.getAlgorithmURI());
-        
+
         byte[] digest = digestAlgorithm.digest("test-string".getBytes());
         assertNotNull(digest);
         assertTrue(digest.length > 0);
-        
+
         // Now compare against a JDK MessageDigest Object
         MessageDigest md = MessageDigest.getInstance("MD5");
         byte[] digest2 = md.digest("test-string".getBytes());
         assertTrue(Arrays.equals(digest, digest2));
     }
-    
+
     @org.junit.Test
     public void testRIPEMD160() throws Exception {
         // This only works with BouncyCastle
@@ -177,21 +177,21 @@ public class DigestAlgorithmTest extends
             return;
         }
         Document doc = XMLUtils.createDocumentBuilder(false).newDocument();
-        
-        MessageDigestAlgorithm digestAlgorithm = 
+
+        MessageDigestAlgorithm digestAlgorithm =
             MessageDigestAlgorithm.getInstance(doc, MessageDigestAlgorithm.ALGO_ID_DIGEST_RIPEMD160);
         assertEquals(MessageDigestAlgorithm.ALGO_ID_DIGEST_RIPEMD160, digestAlgorithm.getAlgorithmURI());
-        
+
         byte[] digest = digestAlgorithm.digest("test-string".getBytes());
         assertNotNull(digest);
         assertTrue(digest.length > 0);
-        
+
         // Now compare against a JDK MessageDigest Object
         MessageDigest md = MessageDigest.getInstance("RIPEMD160");
         byte[] digest2 = md.digest("test-string".getBytes());
         assertTrue(Arrays.equals(digest, digest2));
     }
-    
+
     @org.junit.Test
     public void testWhirlpool() throws Exception {
         // This only works with BouncyCastle
@@ -199,21 +199,21 @@ public class DigestAlgorithmTest extends
             return;
         }
         Document doc = XMLUtils.createDocumentBuilder(false).newDocument();
-        
-        MessageDigestAlgorithm digestAlgorithm = 
+
+        MessageDigestAlgorithm digestAlgorithm =
             MessageDigestAlgorithm.getInstance(doc, MessageDigestAlgorithm.ALGO_ID_DIGEST_WHIRLPOOL);
         assertEquals(MessageDigestAlgorithm.ALGO_ID_DIGEST_WHIRLPOOL, digestAlgorithm.getAlgorithmURI());
-        
+
         byte[] digest = digestAlgorithm.digest("test-string".getBytes());
         assertNotNull(digest);
         assertTrue(digest.length > 0);
-        
+
         // Now compare against a JDK MessageDigest Object
         MessageDigest md = MessageDigest.getInstance("WHIRLPOOL");
         byte[] digest2 = md.digest("test-string".getBytes());
         assertTrue(Arrays.equals(digest, digest2));
     }
-    
+
     @org.junit.Test
     public void testSHA3_224() throws Exception {
         // This only works with BouncyCastle
@@ -221,21 +221,21 @@ public class DigestAlgorithmTest extends
             return;
         }
         Document doc = XMLUtils.createDocumentBuilder(false).newDocument();
-        
-        MessageDigestAlgorithm digestAlgorithm = 
+
+        MessageDigestAlgorithm digestAlgorithm =
             MessageDigestAlgorithm.getInstance(doc, MessageDigestAlgorithm.ALGO_ID_DIGEST_SHA3_224);
         assertEquals(MessageDigestAlgorithm.ALGO_ID_DIGEST_SHA3_224, digestAlgorithm.getAlgorithmURI());
-        
+
         byte[] digest = digestAlgorithm.digest("test-string".getBytes());
         assertNotNull(digest);
         assertTrue(digest.length > 0);
-        
+
         // Now compare against a JDK MessageDigest Object
         MessageDigest md = MessageDigest.getInstance("SHA3-224");
         byte[] digest2 = md.digest("test-string".getBytes());
         assertTrue(Arrays.equals(digest, digest2));
     }
-    
+
     @org.junit.Test
     public void testSHA3_256() throws Exception {
         // This only works with BouncyCastle
@@ -243,21 +243,21 @@ public class DigestAlgorithmTest extends
             return;
         }
         Document doc = XMLUtils.createDocumentBuilder(false).newDocument();
-        
-        MessageDigestAlgorithm digestAlgorithm = 
+
+        MessageDigestAlgorithm digestAlgorithm =
             MessageDigestAlgorithm.getInstance(doc, MessageDigestAlgorithm.ALGO_ID_DIGEST_SHA3_256);
         assertEquals(MessageDigestAlgorithm.ALGO_ID_DIGEST_SHA3_256, digestAlgorithm.getAlgorithmURI());
-        
+
         byte[] digest = digestAlgorithm.digest("test-string".getBytes());
         assertNotNull(digest);
         assertTrue(digest.length > 0);
-        
+
         // Now compare against a JDK MessageDigest Object
         MessageDigest md = MessageDigest.getInstance("SHA3-256");
         byte[] digest2 = md.digest("test-string".getBytes());
         assertTrue(Arrays.equals(digest, digest2));
     }
-    
+
     @org.junit.Test
     public void testSHA3_384() throws Exception {
         // This only works with BouncyCastle
@@ -265,21 +265,21 @@ public class DigestAlgorithmTest extends
             return;
         }
         Document doc = XMLUtils.createDocumentBuilder(false).newDocument();
-        
-        MessageDigestAlgorithm digestAlgorithm = 
+
+        MessageDigestAlgorithm digestAlgorithm =
             MessageDigestAlgorithm.getInstance(doc, MessageDigestAlgorithm.ALGO_ID_DIGEST_SHA3_384);
         assertEquals(MessageDigestAlgorithm.ALGO_ID_DIGEST_SHA3_384, digestAlgorithm.getAlgorithmURI());
-        
+
         byte[] digest = digestAlgorithm.digest("test-string".getBytes());
         assertNotNull(digest);
         assertTrue(digest.length > 0);
-        
+
         // Now compare against a JDK MessageDigest Object
         MessageDigest md = MessageDigest.getInstance("SHA3-384");
         byte[] digest2 = md.digest("test-string".getBytes());
         assertTrue(Arrays.equals(digest, digest2));
     }
-    
+
     @org.junit.Test
     public void testSHA3_512() throws Exception {
         // This only works with BouncyCastle
@@ -287,19 +287,19 @@ public class DigestAlgorithmTest extends
             return;
         }
         Document doc = XMLUtils.createDocumentBuilder(false).newDocument();
-        
-        MessageDigestAlgorithm digestAlgorithm = 
+
+        MessageDigestAlgorithm digestAlgorithm =
             MessageDigestAlgorithm.getInstance(doc, MessageDigestAlgorithm.ALGO_ID_DIGEST_SHA3_512);
         assertEquals(MessageDigestAlgorithm.ALGO_ID_DIGEST_SHA3_512, digestAlgorithm.getAlgorithmURI());
-        
+
         byte[] digest = digestAlgorithm.digest("test-string".getBytes());
         assertNotNull(digest);
         assertTrue(digest.length > 0);
-        
+
         // Now compare against a JDK MessageDigest Object
         MessageDigest md = MessageDigest.getInstance("SHA3-512");
         byte[] digest2 = md.digest("test-string".getBytes());
         assertTrue(Arrays.equals(digest, digest2));
     }
-    
+
 }

Modified: santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/algorithms/HMACSignatureAlgorithmTest.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/algorithms/HMACSignatureAlgorithmTest.java?rev=1720201&r1=1720200&r2=1720201&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/algorithms/HMACSignatureAlgorithmTest.java (original)
+++ santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/algorithms/HMACSignatureAlgorithmTest.java Tue Dec 15 17:13:17 2015
@@ -51,12 +51,12 @@ public class HMACSignatureAlgorithmTest
     static {
         org.apache.xml.security.Init.init();
     }
-    
+
     private boolean bcInstalled;
-    
+
     public HMACSignatureAlgorithmTest() throws Exception {
         //
-        // If the BouncyCastle provider is not installed, then try to load it 
+        // If the BouncyCastle provider is not installed, then try to load it
         // via reflection.
         //
         if (Security.getProvider("BC") == null) {
@@ -79,152 +79,152 @@ public class HMACSignatureAlgorithmTest
     public static void cleanup() throws Exception {
         Security.removeProvider("org.bouncycastle.jce.provider.BouncyCastleProvider");
     }
-    
+
     @org.junit.Test
     public void testHMACSHA1() throws Exception {
         // Read in plaintext document
-        InputStream sourceDocument = 
+        InputStream sourceDocument =
                 this.getClass().getClassLoader().getResourceAsStream(
                         "ie/baltimore/merlin-examples/merlin-xmlenc-five/plaintext.xml");
         DocumentBuilder builder = XMLUtils.createDocumentBuilder(false);
         Document document = builder.parse(sourceDocument);
-        
+
         // Set up the Key
         byte[] hmacKey = "secret".getBytes("ASCII");
         SecretKey key = new SecretKeySpec(hmacKey, "http://www.w3.org/2000/09/xmldsig#hmac-sha1");
-        
+
         List<String> localNames = new ArrayList<String>();
         localNames.add("PaymentInfo");
-        
+
         sign("http://www.w3.org/2000/09/xmldsig#hmac-sha1", document, localNames, key);
         // XMLUtils.outputDOM(document, System.out);
         verify(document, key, localNames);
     }
-    
+
     @org.junit.Test
     public void testHMACMD5() throws Exception {
         // Read in plaintext document
-        InputStream sourceDocument = 
+        InputStream sourceDocument =
                 this.getClass().getClassLoader().getResourceAsStream(
                         "ie/baltimore/merlin-examples/merlin-xmlenc-five/plaintext.xml");
         DocumentBuilder builder = XMLUtils.createDocumentBuilder(false);
         Document document = builder.parse(sourceDocument);
-        
+
         // Set up the Key
         byte[] hmacKey = "secret".getBytes("ASCII");
         SecretKey key = new SecretKeySpec(hmacKey, "http://www.w3.org/2001/04/xmldsig-more#hmac-md5");
-        
+
         List<String> localNames = new ArrayList<String>();
         localNames.add("PaymentInfo");
-        
+
         sign("http://www.w3.org/2001/04/xmldsig-more#hmac-md5", document, localNames, key);
         // XMLUtils.outputDOM(document, System.out);
         verify(document, key, localNames);
     }
-    
+
     @org.junit.Test
     public void testHMACSHA_224() throws Exception {
         // Read in plaintext document
-        InputStream sourceDocument = 
+        InputStream sourceDocument =
                 this.getClass().getClassLoader().getResourceAsStream(
                         "ie/baltimore/merlin-examples/merlin-xmlenc-five/plaintext.xml");
         DocumentBuilder builder = XMLUtils.createDocumentBuilder(false);
         Document document = builder.parse(sourceDocument);
-        
+
         // Set up the Key
         byte[] hmacKey = "secret".getBytes("ASCII");
         SecretKey key = new SecretKeySpec(hmacKey, "http://www.w3.org/2001/04/xmldsig-more#hmac-sha224");
-        
+
         List<String> localNames = new ArrayList<String>();
         localNames.add("PaymentInfo");
-        
+
         sign("http://www.w3.org/2001/04/xmldsig-more#hmac-sha224", document, localNames, key);
         // XMLUtils.outputDOM(document, System.out);
         verify(document, key, localNames);
     }
-    
+
     @org.junit.Test
     public void testHMACSHA_256() throws Exception {
         // Read in plaintext document
-        InputStream sourceDocument = 
+        InputStream sourceDocument =
                 this.getClass().getClassLoader().getResourceAsStream(
                         "ie/baltimore/merlin-examples/merlin-xmlenc-five/plaintext.xml");
         DocumentBuilder builder = XMLUtils.createDocumentBuilder(false);
         Document document = builder.parse(sourceDocument);
-        
+
         // Set up the Key
         byte[] hmacKey = "secret".getBytes("ASCII");
         SecretKey key = new SecretKeySpec(hmacKey, "http://www.w3.org/2001/04/xmldsig-more#hmac-sha256");
-        
+
         List<String> localNames = new ArrayList<String>();
         localNames.add("PaymentInfo");
-        
+
         sign("http://www.w3.org/2001/04/xmldsig-more#hmac-sha256", document, localNames, key);
         // XMLUtils.outputDOM(document, System.out);
         verify(document, key, localNames);
     }
-    
+
     @org.junit.Test
     public void testHMACSHA_384() throws Exception {
         // Read in plaintext document
-        InputStream sourceDocument = 
+        InputStream sourceDocument =
                 this.getClass().getClassLoader().getResourceAsStream(
                         "ie/baltimore/merlin-examples/merlin-xmlenc-five/plaintext.xml");
         DocumentBuilder builder = XMLUtils.createDocumentBuilder(false);
         Document document = builder.parse(sourceDocument);
-        
+
         // Set up the Key
         byte[] hmacKey = "secret".getBytes("ASCII");
         SecretKey key = new SecretKeySpec(hmacKey, "http://www.w3.org/2001/04/xmldsig-more#hmac-sha384");
-        
+
         List<String> localNames = new ArrayList<String>();
         localNames.add("PaymentInfo");
-        
+
         sign("http://www.w3.org/2001/04/xmldsig-more#hmac-sha384", document, localNames, key);
         // XMLUtils.outputDOM(document, System.out);
         verify(document, key, localNames);
     }
-    
+
     @org.junit.Test
     public void testHMACSHA_512() throws Exception {
         // Read in plaintext document
-        InputStream sourceDocument = 
+        InputStream sourceDocument =
                 this.getClass().getClassLoader().getResourceAsStream(
                         "ie/baltimore/merlin-examples/merlin-xmlenc-five/plaintext.xml");
         DocumentBuilder builder = XMLUtils.createDocumentBuilder(false);
         Document document = builder.parse(sourceDocument);
-        
+
         // Set up the Key
         byte[] hmacKey = "secret".getBytes("ASCII");
         SecretKey key = new SecretKeySpec(hmacKey, "http://www.w3.org/2001/04/xmldsig-more#hmac-sha512");
-        
+
         List<String> localNames = new ArrayList<String>();
         localNames.add("PaymentInfo");
-        
+
         sign("http://www.w3.org/2001/04/xmldsig-more#hmac-sha512", document, localNames, key);
         // XMLUtils.outputDOM(document, System.out);
         verify(document, key, localNames);
     }
-    
+
     @org.junit.Test
     public void testHMACRIPEMD160() throws Exception {
         if (!bcInstalled) {
             return;
         }
         // Read in plaintext document
-        InputStream sourceDocument = 
+        InputStream sourceDocument =
                 this.getClass().getClassLoader().getResourceAsStream(
                         "ie/baltimore/merlin-examples/merlin-xmlenc-five/plaintext.xml");
         DocumentBuilder builder = XMLUtils.createDocumentBuilder(false);
         Document document = builder.parse(sourceDocument);
-        
+
         // Set up the Key
         byte[] hmacKey = "secret".getBytes("ASCII");
         SecretKey key = new SecretKeySpec(hmacKey, "http://www.w3.org/2001/04/xmldsig-more#hmac-ripemd160");
-        
+
         List<String> localNames = new ArrayList<String>();
         localNames.add("PaymentInfo");
-        
+
         sign("http://www.w3.org/2001/04/xmldsig-more#hmac-ripemd160", document, localNames, key);
         // XMLUtils.outputDOM(document, System.out);
         verify(document, key, localNames);
@@ -273,7 +273,7 @@ public class HMACSignatureAlgorithmTest
 
         return sig;
     }
-    
+
     private void verify(
         Document document,
         Key key,