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 [14/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/org/apache/xml/security/test/dom/algorithms/KeyWrapEncryptionAlgorithmTest.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/algorithms/KeyWrapEncryptionAlgorithmTest.java?rev=1720201&r1=1720200&r2=1720201&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/algorithms/KeyWrapEncryptionAlgorithmTest.java (original)
+++ santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/algorithms/KeyWrapEncryptionAlgorithmTest.java Tue Dec 15 17:13:17 2015
@@ -54,14 +54,14 @@ public class KeyWrapEncryptionAlgorithmT
private KeyPair rsaKeyPair;
private boolean bcInstalled;
-
+
static {
org.apache.xml.security.Init.init();
}
-
+
public KeyWrapEncryptionAlgorithmTest() 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) {
@@ -78,7 +78,7 @@ public class KeyWrapEncryptionAlgorithmT
bcInstalled = true;
}
}
-
+
rsaKeyPair = KeyPairGenerator.getInstance("RSA").genKeyPair();
}
@@ -86,21 +86,21 @@ public class KeyWrapEncryptionAlgorithmT
public static void cleanup() throws Exception {
Security.removeProvider("org.bouncycastle.jce.provider.BouncyCastleProvider");
}
-
+
@org.junit.Test
public void testAES128KW() 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
KeyGenerator keygen = KeyGenerator.getInstance("AES");
keygen.init(128);
SecretKey key = keygen.generateKey();
-
+
// Set up the Key Wrapping Key
XMLCipher cipher = XMLCipher.getInstance(XMLCipher.AES_128_KeyWrap);
keygen = KeyGenerator.getInstance("AES");
@@ -108,40 +108,40 @@ public class KeyWrapEncryptionAlgorithmT
SecretKey keyWrappingKey = keygen.generateKey();
cipher.init(XMLCipher.WRAP_MODE, keyWrappingKey);
EncryptedKey encryptedKey = cipher.encryptKey(document, key);
-
+
List<String> localNames = new ArrayList<String>();
localNames.add("PaymentInfo");
-
+
String encryptionAlgorithm = XMLCipher.AES_128;
-
+
encrypt(encryptedKey, encryptionAlgorithm, document, localNames, key);
-
+
// Check the CreditCard encrypted ok
NodeList nodeList = document.getElementsByTagNameNS("urn:example:po", "CreditCard");
Assert.assertEquals(nodeList.getLength(), 0);
-
+
// XMLUtils.outputDOM(document, System.out);
document = decrypt(document, keyWrappingKey);
-
+
// Check the CreditCard decrypted ok
nodeList = document.getElementsByTagNameNS("urn:example:po", "CreditCard");
Assert.assertEquals(nodeList.getLength(), 1);
}
-
+
@org.junit.Test
public void testAES192KW() 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
KeyGenerator keygen = KeyGenerator.getInstance("AES");
keygen.init(192);
SecretKey key = keygen.generateKey();
-
+
// Set up the Key Wrapping Key
XMLCipher cipher = XMLCipher.getInstance(XMLCipher.AES_192_KeyWrap);
keygen = KeyGenerator.getInstance("AES");
@@ -149,40 +149,40 @@ public class KeyWrapEncryptionAlgorithmT
SecretKey keyWrappingKey = keygen.generateKey();
cipher.init(XMLCipher.WRAP_MODE, keyWrappingKey);
EncryptedKey encryptedKey = cipher.encryptKey(document, key);
-
+
List<String> localNames = new ArrayList<String>();
localNames.add("PaymentInfo");
-
+
String encryptionAlgorithm = XMLCipher.AES_192;
-
+
encrypt(encryptedKey, encryptionAlgorithm, document, localNames, key);
-
+
// Check the CreditCard encrypted ok
NodeList nodeList = document.getElementsByTagNameNS("urn:example:po", "CreditCard");
Assert.assertEquals(nodeList.getLength(), 0);
-
+
// XMLUtils.outputDOM(document, System.out);
document = decrypt(document, keyWrappingKey);
-
+
// Check the CreditCard decrypted ok
nodeList = document.getElementsByTagNameNS("urn:example:po", "CreditCard");
Assert.assertEquals(nodeList.getLength(), 1);
}
-
+
@org.junit.Test
public void testAES256KW() 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
KeyGenerator keygen = KeyGenerator.getInstance("AES");
keygen.init(256);
SecretKey key = keygen.generateKey();
-
+
// Set up the Key Wrapping Key
XMLCipher cipher = XMLCipher.getInstance(XMLCipher.AES_256_KeyWrap);
keygen = KeyGenerator.getInstance("AES");
@@ -190,193 +190,193 @@ public class KeyWrapEncryptionAlgorithmT
SecretKey keyWrappingKey = keygen.generateKey();
cipher.init(XMLCipher.WRAP_MODE, keyWrappingKey);
EncryptedKey encryptedKey = cipher.encryptKey(document, key);
-
+
List<String> localNames = new ArrayList<String>();
localNames.add("PaymentInfo");
-
+
String encryptionAlgorithm = XMLCipher.AES_256;
-
+
encrypt(encryptedKey, encryptionAlgorithm, document, localNames, key);
-
+
// Check the CreditCard encrypted ok
NodeList nodeList = document.getElementsByTagNameNS("urn:example:po", "CreditCard");
Assert.assertEquals(nodeList.getLength(), 0);
-
+
// XMLUtils.outputDOM(document, System.out);
document = decrypt(document, keyWrappingKey);
-
+
// Check the CreditCard decrypted ok
nodeList = document.getElementsByTagNameNS("urn:example:po", "CreditCard");
Assert.assertEquals(nodeList.getLength(), 1);
}
-
+
@org.junit.Test
public void testTripleDESKW() 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
KeyGenerator keygen = KeyGenerator.getInstance("DESede");
SecretKey key = keygen.generateKey();
-
+
// Set up the Key Wrapping Key
XMLCipher cipher = XMLCipher.getInstance(XMLCipher.TRIPLEDES_KeyWrap);
keygen = KeyGenerator.getInstance("DESede");
SecretKey keyWrappingKey = keygen.generateKey();
cipher.init(XMLCipher.WRAP_MODE, keyWrappingKey);
EncryptedKey encryptedKey = cipher.encryptKey(document, key);
-
+
List<String> localNames = new ArrayList<String>();
localNames.add("PaymentInfo");
-
+
String encryptionAlgorithm = XMLCipher.TRIPLEDES;
-
+
encrypt(encryptedKey, encryptionAlgorithm, document, localNames, key);
-
+
// Check the CreditCard encrypted ok
NodeList nodeList = document.getElementsByTagNameNS("urn:example:po", "CreditCard");
Assert.assertEquals(nodeList.getLength(), 0);
-
+
// XMLUtils.outputDOM(document, System.out);
document = decrypt(document, keyWrappingKey);
-
+
// Check the CreditCard decrypted ok
nodeList = document.getElementsByTagNameNS("urn:example:po", "CreditCard");
Assert.assertEquals(nodeList.getLength(), 1);
}
-
+
@org.junit.Test
public void testRSAv15KW() 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
KeyGenerator keygen = KeyGenerator.getInstance("DESede");
SecretKey key = keygen.generateKey();
-
+
// Set up the Key Wrapping Key
XMLCipher cipher = XMLCipher.getInstance(XMLCipher.RSA_v1dot5);
cipher.init(XMLCipher.WRAP_MODE, rsaKeyPair.getPublic());
EncryptedKey encryptedKey = cipher.encryptKey(document, key);
-
+
List<String> localNames = new ArrayList<String>();
localNames.add("PaymentInfo");
-
+
String encryptionAlgorithm = XMLCipher.TRIPLEDES;
-
+
encrypt(encryptedKey, encryptionAlgorithm, document, localNames, key);
-
+
// Check the CreditCard encrypted ok
NodeList nodeList = document.getElementsByTagNameNS("urn:example:po", "CreditCard");
Assert.assertEquals(nodeList.getLength(), 0);
-
+
// XMLUtils.outputDOM(document, System.out);
document = decrypt(document, rsaKeyPair.getPrivate());
-
+
// Check the CreditCard decrypted ok
nodeList = document.getElementsByTagNameNS("urn:example:po", "CreditCard");
Assert.assertEquals(nodeList.getLength(), 1);
}
-
+
@org.junit.Test
public void testRSAOAEPKW() 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
KeyGenerator keygen = KeyGenerator.getInstance("DESede");
SecretKey key = keygen.generateKey();
-
+
// Set up the Key Wrapping Key
XMLCipher cipher = XMLCipher.getInstance(XMLCipher.RSA_OAEP);
cipher.init(XMLCipher.WRAP_MODE, rsaKeyPair.getPublic());
EncryptedKey encryptedKey = cipher.encryptKey(document, key);
-
+
List<String> localNames = new ArrayList<String>();
localNames.add("PaymentInfo");
-
+
String encryptionAlgorithm = XMLCipher.TRIPLEDES;
-
+
encrypt(encryptedKey, encryptionAlgorithm, document, localNames, key);
-
+
// Check the CreditCard encrypted ok
NodeList nodeList = document.getElementsByTagNameNS("urn:example:po", "CreditCard");
Assert.assertEquals(nodeList.getLength(), 0);
-
+
// XMLUtils.outputDOM(document, System.out);
document = decrypt(document, rsaKeyPair.getPrivate());
-
+
// Check the CreditCard decrypted ok
nodeList = document.getElementsByTagNameNS("urn:example:po", "CreditCard");
Assert.assertEquals(nodeList.getLength(), 1);
}
-
+
@org.junit.Test
public void testRSAOAEP11KW() 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
KeyGenerator keygen = KeyGenerator.getInstance("DESede");
SecretKey key = keygen.generateKey();
-
+
// Set up the Key Wrapping Key
XMLCipher cipher = XMLCipher.getInstance(XMLCipher.RSA_OAEP_11);
cipher.init(XMLCipher.WRAP_MODE, rsaKeyPair.getPublic());
EncryptedKey encryptedKey = cipher.encryptKey(document, key);
-
+
List<String> localNames = new ArrayList<String>();
localNames.add("PaymentInfo");
-
+
String encryptionAlgorithm = XMLCipher.TRIPLEDES;
-
+
encrypt(encryptedKey, encryptionAlgorithm, document, localNames, key);
-
+
// Check the CreditCard encrypted ok
NodeList nodeList = document.getElementsByTagNameNS("urn:example:po", "CreditCard");
Assert.assertEquals(nodeList.getLength(), 0);
-
+
// XMLUtils.outputDOM(document, System.out);
document = decrypt(document, rsaKeyPair.getPrivate());
-
+
// Check the CreditCard decrypted ok
nodeList = document.getElementsByTagNameNS("urn:example:po", "CreditCard");
Assert.assertEquals(nodeList.getLength(), 1);
}
-
+
@org.junit.Test
public void testCamellia128KW() 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
KeyGenerator keygen = KeyGenerator.getInstance("Camellia");
keygen.init(128);
SecretKey key = keygen.generateKey();
-
+
// Set up the Key Wrapping Key
XMLCipher cipher = XMLCipher.getInstance(XMLCipher.CAMELLIA_128_KeyWrap);
keygen = KeyGenerator.getInstance("Camellia");
@@ -384,43 +384,43 @@ public class KeyWrapEncryptionAlgorithmT
SecretKey keyWrappingKey = keygen.generateKey();
cipher.init(XMLCipher.WRAP_MODE, keyWrappingKey);
EncryptedKey encryptedKey = cipher.encryptKey(document, key);
-
+
List<String> localNames = new ArrayList<String>();
localNames.add("PaymentInfo");
-
+
String encryptionAlgorithm = XMLCipher.CAMELLIA_128;
-
+
encrypt(encryptedKey, encryptionAlgorithm, document, localNames, key);
-
+
// Check the CreditCard encrypted ok
NodeList nodeList = document.getElementsByTagNameNS("urn:example:po", "CreditCard");
Assert.assertEquals(nodeList.getLength(), 0);
-
+
// XMLUtils.outputDOM(document, System.out);
document = decrypt(document, keyWrappingKey);
-
+
// Check the CreditCard decrypted ok
nodeList = document.getElementsByTagNameNS("urn:example:po", "CreditCard");
Assert.assertEquals(nodeList.getLength(), 1);
}
-
+
@org.junit.Test
public void testCamellia192KW() 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
KeyGenerator keygen = KeyGenerator.getInstance("Camellia");
keygen.init(192);
SecretKey key = keygen.generateKey();
-
+
// Set up the Key Wrapping Key
XMLCipher cipher = XMLCipher.getInstance(XMLCipher.CAMELLIA_192_KeyWrap);
keygen = KeyGenerator.getInstance("Camellia");
@@ -428,43 +428,43 @@ public class KeyWrapEncryptionAlgorithmT
SecretKey keyWrappingKey = keygen.generateKey();
cipher.init(XMLCipher.WRAP_MODE, keyWrappingKey);
EncryptedKey encryptedKey = cipher.encryptKey(document, key);
-
+
List<String> localNames = new ArrayList<String>();
localNames.add("PaymentInfo");
-
+
String encryptionAlgorithm = XMLCipher.CAMELLIA_192;
-
+
encrypt(encryptedKey, encryptionAlgorithm, document, localNames, key);
-
+
// Check the CreditCard encrypted ok
NodeList nodeList = document.getElementsByTagNameNS("urn:example:po", "CreditCard");
Assert.assertEquals(nodeList.getLength(), 0);
-
+
// XMLUtils.outputDOM(document, System.out);
document = decrypt(document, keyWrappingKey);
-
+
// Check the CreditCard decrypted ok
nodeList = document.getElementsByTagNameNS("urn:example:po", "CreditCard");
Assert.assertEquals(nodeList.getLength(), 1);
}
-
+
@org.junit.Test
public void testCamellia256KW() 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
KeyGenerator keygen = KeyGenerator.getInstance("Camellia");
keygen.init(256);
SecretKey key = keygen.generateKey();
-
+
// Set up the Key Wrapping Key
XMLCipher cipher = XMLCipher.getInstance(XMLCipher.CAMELLIA_256_KeyWrap);
keygen = KeyGenerator.getInstance("Camellia");
@@ -472,43 +472,43 @@ public class KeyWrapEncryptionAlgorithmT
SecretKey keyWrappingKey = keygen.generateKey();
cipher.init(XMLCipher.WRAP_MODE, keyWrappingKey);
EncryptedKey encryptedKey = cipher.encryptKey(document, key);
-
+
List<String> localNames = new ArrayList<String>();
localNames.add("PaymentInfo");
-
+
String encryptionAlgorithm = XMLCipher.CAMELLIA_256;
-
+
encrypt(encryptedKey, encryptionAlgorithm, document, localNames, key);
-
+
// Check the CreditCard encrypted ok
NodeList nodeList = document.getElementsByTagNameNS("urn:example:po", "CreditCard");
Assert.assertEquals(nodeList.getLength(), 0);
-
+
// XMLUtils.outputDOM(document, System.out);
document = decrypt(document, keyWrappingKey);
-
+
// Check the CreditCard decrypted ok
nodeList = document.getElementsByTagNameNS("urn:example:po", "CreditCard");
Assert.assertEquals(nodeList.getLength(), 1);
}
-
+
@org.junit.Test
public void testSEED128KW() 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
KeyGenerator keygen = KeyGenerator.getInstance("SEED");
keygen.init(128);
SecretKey key = keygen.generateKey();
-
+
// Set up the Key Wrapping Key
XMLCipher cipher = XMLCipher.getInstance(XMLCipher.SEED_128_KeyWrap);
keygen = KeyGenerator.getInstance("SEED");
@@ -516,26 +516,26 @@ public class KeyWrapEncryptionAlgorithmT
SecretKey keyWrappingKey = keygen.generateKey();
cipher.init(XMLCipher.WRAP_MODE, keyWrappingKey);
EncryptedKey encryptedKey = cipher.encryptKey(document, key);
-
+
List<String> localNames = new ArrayList<String>();
localNames.add("PaymentInfo");
-
+
String encryptionAlgorithm = XMLCipher.SEED_128;
-
+
encrypt(encryptedKey, encryptionAlgorithm, document, localNames, key);
-
+
// Check the CreditCard encrypted ok
NodeList nodeList = document.getElementsByTagNameNS("urn:example:po", "CreditCard");
Assert.assertEquals(nodeList.getLength(), 0);
-
+
// XMLUtils.outputDOM(document, System.out);
document = decrypt(document, keyWrappingKey);
-
+
// Check the CreditCard decrypted ok
nodeList = document.getElementsByTagNameNS("urn:example:po", "CreditCard");
Assert.assertEquals(nodeList.getLength(), 1);
}
-
+
private void encrypt(
EncryptedKey encryptedKey,
String algorithm,
@@ -545,7 +545,7 @@ public class KeyWrapEncryptionAlgorithmT
) throws Exception {
XMLCipher cipher = XMLCipher.getInstance(algorithm);
cipher.init(XMLCipher.ENCRYPT_MODE, encryptingKey);
-
+
XPathFactory xpf = XPathFactory.newInstance();
XPath xpath = xpf.newXPath();
xpath.setNamespaceContext(new DSNamespaceContext());
@@ -557,7 +557,7 @@ public class KeyWrapEncryptionAlgorithmT
builder.setKeyInfo(builderKeyInfo);
}
builderKeyInfo.add(encryptedKey);
-
+
for (String localName : localNames) {
String expression = "//*[local-name()='" + localName + "']";
Element elementToEncrypt =
@@ -566,14 +566,14 @@ public class KeyWrapEncryptionAlgorithmT
document = cipher.doFinal(document, elementToEncrypt, false);
}
-
+
NodeList nodeList = document.getElementsByTagNameNS(
XMLSecurityConstants.TAG_xenc_EncryptedData.getNamespaceURI(),
XMLSecurityConstants.TAG_xenc_EncryptedData.getLocalPart()
);
Assert.assertTrue(nodeList.getLength() > 0);
}
-
+
private Document decrypt(
Document document,
Key keyWrappingKey
@@ -583,7 +583,7 @@ public class KeyWrapEncryptionAlgorithmT
XMLSecurityConstants.TAG_xenc_EncryptedData.getLocalPart()
);
Element ee = (Element)nodeList.item(0);
-
+
// Need to pre-load the Encrypted Data so we can get the key info
XMLCipher cipher = XMLCipher.getInstance();
cipher.init(XMLCipher.DECRYPT_MODE, null);
@@ -593,14 +593,14 @@ public class KeyWrapEncryptionAlgorithmT
kwCipher.init(XMLCipher.UNWRAP_MODE, keyWrappingKey);
KeyInfo ki = encryptedData.getKeyInfo();
EncryptedKey encryptedKey = ki.itemEncryptedKey(0);
- Key symmetricKey =
+ Key symmetricKey =
kwCipher.decryptKey(
encryptedKey, encryptedData.getEncryptionMethod().getAlgorithm()
);
-
+
cipher.init(XMLCipher.DECRYPT_MODE, symmetricKey);
return cipher.doFinal(document, ee);
}
-
+
}
Modified: santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/algorithms/PKSignatureAlgorithmTest.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/algorithms/PKSignatureAlgorithmTest.java?rev=1720201&r1=1720200&r2=1720201&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/algorithms/PKSignatureAlgorithmTest.java (original)
+++ santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/algorithms/PKSignatureAlgorithmTest.java Tue Dec 15 17:13:17 2015
@@ -47,17 +47,17 @@ import org.w3c.dom.NodeList;
* A test to make sure that the various Public Key Signature algorithms are working
*/
public class PKSignatureAlgorithmTest extends org.junit.Assert {
-
+
private KeyPair rsaKeyPair, ecKeyPair;
private boolean bcInstalled;
static {
org.apache.xml.security.Init.init();
}
-
+
public PKSignatureAlgorithmTest() 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) {
@@ -74,11 +74,11 @@ public class PKSignatureAlgorithmTest ex
bcInstalled = true;
}
}
-
+
KeyPairGenerator rsaKpg = KeyPairGenerator.getInstance("RSA");
rsaKpg.initialize(2048);
rsaKeyPair = rsaKpg.genKeyPair();
-
+
ecKeyPair = KeyPairGenerator.getInstance("EC").genKeyPair();
}
@@ -86,334 +86,334 @@ public class PKSignatureAlgorithmTest ex
public static void cleanup() throws Exception {
Security.removeProvider("org.bouncycastle.jce.provider.BouncyCastleProvider");
}
-
+
@org.junit.Test
public void testRSA_MD5() 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);
-
+
List<String> localNames = new ArrayList<String>();
localNames.add("PaymentInfo");
-
+
sign(XMLSignature.ALGO_ID_SIGNATURE_NOT_RECOMMENDED_RSA_MD5, document, localNames, rsaKeyPair.getPrivate());
// XMLUtils.outputDOM(document, System.out);
verify(document, rsaKeyPair.getPublic(), localNames);
}
-
+
@org.junit.Test
public void testRSA_SHA1() 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);
-
+
List<String> localNames = new ArrayList<String>();
localNames.add("PaymentInfo");
-
+
sign(XMLSignature.ALGO_ID_SIGNATURE_RSA_SHA1, document, localNames, rsaKeyPair.getPrivate());
// XMLUtils.outputDOM(document, System.out);
verify(document, rsaKeyPair.getPublic(), localNames);
}
-
+
@org.junit.Test
public void testRSA_SHA_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);
-
+
List<String> localNames = new ArrayList<String>();
localNames.add("PaymentInfo");
-
+
sign(XMLSignature.ALGO_ID_SIGNATURE_RSA_SHA224, document, localNames, rsaKeyPair.getPrivate());
// XMLUtils.outputDOM(document, System.out);
verify(document, rsaKeyPair.getPublic(), localNames);
}
-
+
@org.junit.Test
public void testRSA_SHA_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);
-
+
List<String> localNames = new ArrayList<String>();
localNames.add("PaymentInfo");
-
+
sign(XMLSignature.ALGO_ID_SIGNATURE_RSA_SHA256, document, localNames, rsaKeyPair.getPrivate());
// XMLUtils.outputDOM(document, System.out);
verify(document, rsaKeyPair.getPublic(), localNames);
}
-
+
@org.junit.Test
public void testRSA_SHA_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);
-
+
List<String> localNames = new ArrayList<String>();
localNames.add("PaymentInfo");
-
+
sign(XMLSignature.ALGO_ID_SIGNATURE_RSA_SHA384, document, localNames, rsaKeyPair.getPrivate());
// XMLUtils.outputDOM(document, System.out);
verify(document, rsaKeyPair.getPublic(), localNames);
}
-
+
@org.junit.Test
public void testRSA_SHA_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);
-
+
List<String> localNames = new ArrayList<String>();
localNames.add("PaymentInfo");
-
+
sign(XMLSignature.ALGO_ID_SIGNATURE_RSA_SHA512, document, localNames, rsaKeyPair.getPrivate());
// XMLUtils.outputDOM(document, System.out);
verify(document, rsaKeyPair.getPublic(), localNames);
}
-
+
@org.junit.Test
public void testRSA_RIPEMD160() 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);
-
+
List<String> localNames = new ArrayList<String>();
localNames.add("PaymentInfo");
-
+
sign(XMLSignature.ALGO_ID_SIGNATURE_RSA_RIPEMD160, document, localNames, rsaKeyPair.getPrivate());
// XMLUtils.outputDOM(document, System.out);
verify(document, rsaKeyPair.getPublic(), localNames);
}
-
+
@org.junit.Test
public void testRSA_SHA1_MGF1() 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);
-
+
List<String> localNames = new ArrayList<String>();
localNames.add("PaymentInfo");
-
+
sign(XMLSignature.ALGO_ID_SIGNATURE_RSA_SHA1_MGF1, document, localNames, rsaKeyPair.getPrivate());
// XMLUtils.outputDOM(document, System.out);
verify(document, rsaKeyPair.getPublic(), localNames);
}
-
+
@org.junit.Test
public void testRSA_SHA224_MGF1() 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);
-
+
List<String> localNames = new ArrayList<String>();
localNames.add("PaymentInfo");
-
+
sign(XMLSignature.ALGO_ID_SIGNATURE_RSA_SHA224_MGF1, document, localNames, rsaKeyPair.getPrivate());
// XMLUtils.outputDOM(document, System.out);
verify(document, rsaKeyPair.getPublic(), localNames);
}
-
+
@org.junit.Test
public void testRSA_SHA256_MGF1() 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);
-
+
List<String> localNames = new ArrayList<String>();
localNames.add("PaymentInfo");
-
+
sign(XMLSignature.ALGO_ID_SIGNATURE_RSA_SHA256_MGF1, document, localNames, rsaKeyPair.getPrivate());
// XMLUtils.outputDOM(document, System.out);
verify(document, rsaKeyPair.getPublic(), localNames);
}
-
+
@org.junit.Test
public void testRSA_SHA384_MGF1() 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);
-
+
List<String> localNames = new ArrayList<String>();
localNames.add("PaymentInfo");
-
+
sign(XMLSignature.ALGO_ID_SIGNATURE_RSA_SHA384_MGF1, document, localNames, rsaKeyPair.getPrivate());
// XMLUtils.outputDOM(document, System.out);
verify(document, rsaKeyPair.getPublic(), localNames);
}
-
+
@org.junit.Test
public void testRSA_SHA512_MGF1() 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);
-
+
List<String> localNames = new ArrayList<String>();
localNames.add("PaymentInfo");
-
+
sign(XMLSignature.ALGO_ID_SIGNATURE_RSA_SHA512_MGF1, document, localNames, rsaKeyPair.getPrivate());
// XMLUtils.outputDOM(document, System.out);
verify(document, rsaKeyPair.getPublic(), localNames);
}
-
+
@org.junit.Test
public void testECDSA_SHA1() 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);
-
+
List<String> localNames = new ArrayList<String>();
localNames.add("PaymentInfo");
-
+
sign(XMLSignature.ALGO_ID_SIGNATURE_ECDSA_SHA1, document, localNames, ecKeyPair.getPrivate());
// XMLUtils.outputDOM(document, System.out);
verify(document, ecKeyPair.getPublic(), localNames);
}
-
+
@org.junit.Test
public void testECDSA_SHA_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);
-
+
List<String> localNames = new ArrayList<String>();
localNames.add("PaymentInfo");
-
+
sign(XMLSignature.ALGO_ID_SIGNATURE_ECDSA_SHA224, document, localNames, ecKeyPair.getPrivate());
// XMLUtils.outputDOM(document, System.out);
verify(document, ecKeyPair.getPublic(), localNames);
}
-
+
@org.junit.Test
public void testECDSA_SHA_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);
-
+
List<String> localNames = new ArrayList<String>();
localNames.add("PaymentInfo");
-
+
sign(XMLSignature.ALGO_ID_SIGNATURE_ECDSA_SHA256, document, localNames, ecKeyPair.getPrivate());
// XMLUtils.outputDOM(document, System.out);
verify(document, ecKeyPair.getPublic(), localNames);
}
-
+
@org.junit.Test
public void testECDSA_SHA_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);
-
+
List<String> localNames = new ArrayList<String>();
localNames.add("PaymentInfo");
-
+
sign(XMLSignature.ALGO_ID_SIGNATURE_ECDSA_SHA384, document, localNames, ecKeyPair.getPrivate());
// XMLUtils.outputDOM(document, System.out);
verify(document, ecKeyPair.getPublic(), localNames);
}
-
+
@org.junit.Test
public void testECDSA_SHA_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);
-
+
List<String> localNames = new ArrayList<String>();
localNames.add("PaymentInfo");
-
+
sign(XMLSignature.ALGO_ID_SIGNATURE_ECDSA_SHA512, document, localNames, ecKeyPair.getPrivate());
// XMLUtils.outputDOM(document, System.out);
verify(document, ecKeyPair.getPublic(), localNames);
}
-
+
@org.junit.Test
public void testECDSA_RIPEMD160() 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);
-
+
List<String> localNames = new ArrayList<String>();
localNames.add("PaymentInfo");
-
+
sign(XMLSignature.ALGO_ID_SIGNATURE_ECDSA_RIPEMD160, document, localNames, ecKeyPair.getPrivate());
// XMLUtils.outputDOM(document, System.out);
verify(document, ecKeyPair.getPublic(), localNames);
}
-
+
private XMLSignature sign(
String algorithm,
Document document,
@@ -457,7 +457,7 @@ public class PKSignatureAlgorithmTest ex
return sig;
}
-
+
private void verify(
Document document,
Key key,
Modified: santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/algorithms/SignatureAlgorithmTest.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/algorithms/SignatureAlgorithmTest.java?rev=1720201&r1=1720200&r2=1720201&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/algorithms/SignatureAlgorithmTest.java (original)
+++ santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/algorithms/SignatureAlgorithmTest.java Tue Dec 15 17:13:17 2015
@@ -39,7 +39,7 @@ public class SignatureAlgorithmTest exte
@org.junit.Test
public void testSameKeySeveralAlgorithmSigning() throws Exception {
Document doc = XMLUtils.createDocumentBuilder(false).newDocument();
- SignatureAlgorithm signatureAlgorithm =
+ SignatureAlgorithm signatureAlgorithm =
new SignatureAlgorithm(doc, XMLSignature.ALGO_ID_SIGNATURE_RSA_SHA1);
PrivateKey pk = KeyPairGenerator.getInstance("RSA").genKeyPair().getPrivate();
signatureAlgorithm.initSign(pk);
@@ -61,5 +61,5 @@ public class SignatureAlgorithmTest exte
otherSignatureAlgorithm.update((byte)2);
otherSignatureAlgorithm.sign();
}
-
+
}
Modified: santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/algorithms/SymmetricEncryptionAlgorithmTest.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/algorithms/SymmetricEncryptionAlgorithmTest.java?rev=1720201&r1=1720200&r2=1720201&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/algorithms/SymmetricEncryptionAlgorithmTest.java (original)
+++ santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/algorithms/SymmetricEncryptionAlgorithmTest.java Tue Dec 15 17:13:17 2015
@@ -46,16 +46,16 @@ import org.w3c.dom.NodeList;
* A test to make sure that the various Symmetric Encryption algorithms are working
*/
public class SymmetricEncryptionAlgorithmTest extends org.junit.Assert {
-
+
private boolean bcInstalled;
static {
org.apache.xml.security.Init.init();
}
-
+
public SymmetricEncryptionAlgorithmTest() 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) {
@@ -77,381 +77,381 @@ public class SymmetricEncryptionAlgorith
public static void cleanup() throws Exception {
Security.removeProvider("org.bouncycastle.jce.provider.BouncyCastleProvider");
}
-
+
@org.junit.Test
public void testAES128() 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
KeyGenerator keygen = KeyGenerator.getInstance("AES");
keygen.init(128);
SecretKey key = keygen.generateKey();
-
+
List<String> localNames = new ArrayList<String>();
localNames.add("PaymentInfo");
-
+
String encryptionAlgorithm = XMLCipher.AES_128;
-
+
encrypt(encryptionAlgorithm, document, localNames, key);
-
+
// Check the CreditCard encrypted ok
NodeList nodeList = document.getElementsByTagNameNS("urn:example:po", "CreditCard");
Assert.assertEquals(nodeList.getLength(), 0);
-
+
// XMLUtils.outputDOM(document, System.out);
document = decrypt(encryptionAlgorithm, document, key, localNames);
-
+
// Check the CreditCard decrypted ok
nodeList = document.getElementsByTagNameNS("urn:example:po", "CreditCard");
Assert.assertEquals(nodeList.getLength(), 1);
}
-
+
@org.junit.Test
public void testAES128_GCM() 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
KeyGenerator keygen = KeyGenerator.getInstance("AES");
keygen.init(128);
SecretKey key = keygen.generateKey();
-
+
List<String> localNames = new ArrayList<String>();
localNames.add("PaymentInfo");
-
+
String encryptionAlgorithm = XMLCipher.AES_128_GCM;
-
+
encrypt(encryptionAlgorithm, document, localNames, key);
-
+
// Check the CreditCard encrypted ok
NodeList nodeList = document.getElementsByTagNameNS("urn:example:po", "CreditCard");
Assert.assertEquals(nodeList.getLength(), 0);
-
+
// XMLUtils.outputDOM(document, System.out);
document = decrypt(encryptionAlgorithm, document, key, localNames);
-
+
// Check the CreditCard decrypted ok
nodeList = document.getElementsByTagNameNS("urn:example:po", "CreditCard");
Assert.assertEquals(nodeList.getLength(), 1);
}
-
+
@org.junit.Test
public void testAES192() 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
KeyGenerator keygen = KeyGenerator.getInstance("AES");
keygen.init(192);
SecretKey key = keygen.generateKey();
-
+
List<String> localNames = new ArrayList<String>();
localNames.add("PaymentInfo");
-
+
String encryptionAlgorithm = XMLCipher.AES_192;
-
+
encrypt(encryptionAlgorithm, document, localNames, key);
-
+
// Check the CreditCard encrypted ok
NodeList nodeList = document.getElementsByTagNameNS("urn:example:po", "CreditCard");
Assert.assertEquals(nodeList.getLength(), 0);
-
+
// XMLUtils.outputDOM(document, System.out);
document = decrypt(encryptionAlgorithm, document, key, localNames);
-
+
// Check the CreditCard decrypted ok
nodeList = document.getElementsByTagNameNS("urn:example:po", "CreditCard");
Assert.assertEquals(nodeList.getLength(), 1);
}
-
+
@org.junit.Test
public void testAES192_GCM() 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
KeyGenerator keygen = KeyGenerator.getInstance("AES");
keygen.init(192);
SecretKey key = keygen.generateKey();
-
+
List<String> localNames = new ArrayList<String>();
localNames.add("PaymentInfo");
-
+
String encryptionAlgorithm = XMLCipher.AES_192_GCM;
-
+
encrypt(encryptionAlgorithm, document, localNames, key);
-
+
// Check the CreditCard encrypted ok
NodeList nodeList = document.getElementsByTagNameNS("urn:example:po", "CreditCard");
Assert.assertEquals(nodeList.getLength(), 0);
-
+
// XMLUtils.outputDOM(document, System.out);
document = decrypt(encryptionAlgorithm, document, key, localNames);
-
+
// Check the CreditCard decrypted ok
nodeList = document.getElementsByTagNameNS("urn:example:po", "CreditCard");
Assert.assertEquals(nodeList.getLength(), 1);
}
-
+
@org.junit.Test
public void testAES256() 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
KeyGenerator keygen = KeyGenerator.getInstance("AES");
keygen.init(256);
SecretKey key = keygen.generateKey();
-
+
List<String> localNames = new ArrayList<String>();
localNames.add("PaymentInfo");
-
+
String encryptionAlgorithm = XMLCipher.AES_256;
-
+
encrypt(encryptionAlgorithm, document, localNames, key);
-
+
// Check the CreditCard encrypted ok
NodeList nodeList = document.getElementsByTagNameNS("urn:example:po", "CreditCard");
Assert.assertEquals(nodeList.getLength(), 0);
-
+
// XMLUtils.outputDOM(document, System.out);
document = decrypt(encryptionAlgorithm, document, key, localNames);
-
+
// Check the CreditCard decrypted ok
nodeList = document.getElementsByTagNameNS("urn:example:po", "CreditCard");
Assert.assertEquals(nodeList.getLength(), 1);
}
-
+
@org.junit.Test
public void testAES256_GCM() 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
KeyGenerator keygen = KeyGenerator.getInstance("AES");
keygen.init(256);
SecretKey key = keygen.generateKey();
-
+
List<String> localNames = new ArrayList<String>();
localNames.add("PaymentInfo");
-
+
String encryptionAlgorithm = XMLCipher.AES_256_GCM;
-
+
encrypt(encryptionAlgorithm, document, localNames, key);
-
+
// Check the CreditCard encrypted ok
NodeList nodeList = document.getElementsByTagNameNS("urn:example:po", "CreditCard");
Assert.assertEquals(nodeList.getLength(), 0);
-
+
// XMLUtils.outputDOM(document, System.out);
document = decrypt(encryptionAlgorithm, document, key, localNames);
-
+
// Check the CreditCard decrypted ok
nodeList = document.getElementsByTagNameNS("urn:example:po", "CreditCard");
Assert.assertEquals(nodeList.getLength(), 1);
}
-
+
@org.junit.Test
public void testTRIPLE_DES() 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
KeyGenerator keygen = KeyGenerator.getInstance("DESede");
SecretKey key = keygen.generateKey();
-
+
List<String> localNames = new ArrayList<String>();
localNames.add("PaymentInfo");
-
+
String encryptionAlgorithm = XMLCipher.TRIPLEDES;
-
+
encrypt(encryptionAlgorithm, document, localNames, key);
-
+
// Check the CreditCard encrypted ok
NodeList nodeList = document.getElementsByTagNameNS("urn:example:po", "CreditCard");
Assert.assertEquals(nodeList.getLength(), 0);
-
+
// XMLUtils.outputDOM(document, System.out);
document = decrypt(encryptionAlgorithm, document, key, localNames);
-
+
// Check the CreditCard decrypted ok
nodeList = document.getElementsByTagNameNS("urn:example:po", "CreditCard");
Assert.assertEquals(nodeList.getLength(), 1);
}
-
+
@org.junit.Test
public void testSEED_128() 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
KeyGenerator keygen = KeyGenerator.getInstance("SEED");
keygen.init(128);
SecretKey key = keygen.generateKey();
-
+
List<String> localNames = new ArrayList<String>();
localNames.add("PaymentInfo");
-
+
String encryptionAlgorithm = XMLCipher.SEED_128;
-
+
encrypt(encryptionAlgorithm, document, localNames, key);
-
+
// Check the CreditCard encrypted ok
NodeList nodeList = document.getElementsByTagNameNS("urn:example:po", "CreditCard");
Assert.assertEquals(nodeList.getLength(), 0);
-
+
// XMLUtils.outputDOM(document, System.out);
document = decrypt(encryptionAlgorithm, document, key, localNames);
-
+
// Check the CreditCard decrypted ok
nodeList = document.getElementsByTagNameNS("urn:example:po", "CreditCard");
Assert.assertEquals(nodeList.getLength(), 1);
}
-
+
@org.junit.Test
public void testCAMELLIA_128() 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
KeyGenerator keygen = KeyGenerator.getInstance("Camellia");
keygen.init(128);
SecretKey key = keygen.generateKey();
-
+
List<String> localNames = new ArrayList<String>();
localNames.add("PaymentInfo");
-
+
String encryptionAlgorithm = XMLCipher.CAMELLIA_128;
-
+
encrypt(encryptionAlgorithm, document, localNames, key);
-
+
// Check the CreditCard encrypted ok
NodeList nodeList = document.getElementsByTagNameNS("urn:example:po", "CreditCard");
Assert.assertEquals(nodeList.getLength(), 0);
-
+
// XMLUtils.outputDOM(document, System.out);
document = decrypt(encryptionAlgorithm, document, key, localNames);
-
+
// Check the CreditCard decrypted ok
nodeList = document.getElementsByTagNameNS("urn:example:po", "CreditCard");
Assert.assertEquals(nodeList.getLength(), 1);
}
-
+
@org.junit.Test
public void testCAMELLIA_192() 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
KeyGenerator keygen = KeyGenerator.getInstance("Camellia");
keygen.init(192);
SecretKey key = keygen.generateKey();
-
+
List<String> localNames = new ArrayList<String>();
localNames.add("PaymentInfo");
-
+
String encryptionAlgorithm = XMLCipher.CAMELLIA_192;
-
+
encrypt(encryptionAlgorithm, document, localNames, key);
-
+
// Check the CreditCard encrypted ok
NodeList nodeList = document.getElementsByTagNameNS("urn:example:po", "CreditCard");
Assert.assertEquals(nodeList.getLength(), 0);
-
+
// XMLUtils.outputDOM(document, System.out);
document = decrypt(encryptionAlgorithm, document, key, localNames);
-
+
// Check the CreditCard decrypted ok
nodeList = document.getElementsByTagNameNS("urn:example:po", "CreditCard");
Assert.assertEquals(nodeList.getLength(), 1);
}
-
+
@org.junit.Test
public void testCAMELLIA_256() 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
KeyGenerator keygen = KeyGenerator.getInstance("Camellia");
keygen.init(256);
SecretKey key = keygen.generateKey();
-
+
List<String> localNames = new ArrayList<String>();
localNames.add("PaymentInfo");
-
+
String encryptionAlgorithm = XMLCipher.CAMELLIA_256;
-
+
encrypt(encryptionAlgorithm, document, localNames, key);
-
+
// Check the CreditCard encrypted ok
NodeList nodeList = document.getElementsByTagNameNS("urn:example:po", "CreditCard");
Assert.assertEquals(nodeList.getLength(), 0);
-
+
// XMLUtils.outputDOM(document, System.out);
document = decrypt(encryptionAlgorithm, document, key, localNames);
-
+
// Check the CreditCard decrypted ok
nodeList = document.getElementsByTagNameNS("urn:example:po", "CreditCard");
Assert.assertEquals(nodeList.getLength(), 1);
}
-
+
private void encrypt(
String algorithm,
Document document,
@@ -460,7 +460,7 @@ public class SymmetricEncryptionAlgorith
) throws Exception {
XMLCipher cipher = XMLCipher.getInstance(algorithm);
cipher.init(XMLCipher.ENCRYPT_MODE, encryptingKey);
-
+
XPathFactory xpf = XPathFactory.newInstance();
XPath xpath = xpf.newXPath();
xpath.setNamespaceContext(new DSNamespaceContext());
@@ -473,14 +473,14 @@ public class SymmetricEncryptionAlgorith
document = cipher.doFinal(document, elementToEncrypt, false);
}
-
+
NodeList nodeList = document.getElementsByTagNameNS(
XMLSecurityConstants.TAG_xenc_EncryptedData.getNamespaceURI(),
XMLSecurityConstants.TAG_xenc_EncryptedData.getLocalPart()
);
Assert.assertTrue(nodeList.getLength() > 0);
}
-
+
private Document decrypt(
String algorithm,
Document document,
@@ -489,7 +489,7 @@ public class SymmetricEncryptionAlgorith
) throws Exception {
XMLCipher cipher = XMLCipher.getInstance(algorithm);
cipher.init(XMLCipher.DECRYPT_MODE, key);
-
+
NodeList nodeList = document.getElementsByTagNameNS(
XMLSecurityConstants.TAG_xenc_EncryptedData.getNamespaceURI(),
XMLSecurityConstants.TAG_xenc_EncryptedData.getLocalPart()
Modified: santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/c14n/helper/AttrCompareTest.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/c14n/helper/AttrCompareTest.java?rev=1720201&r1=1720200&r2=1720201&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/c14n/helper/AttrCompareTest.java (original)
+++ santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/c14n/helper/AttrCompareTest.java Tue Dec 15 17:13:17 2015
@@ -226,7 +226,7 @@ public class AttrCompareTest extends org
return doc;
}
-
+
}
Modified: santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/c14n/implementations/Bug45961Test.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/c14n/implementations/Bug45961Test.java?rev=1720201&r1=1720200&r2=1720201&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/c14n/implementations/Bug45961Test.java (original)
+++ santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/c14n/implementations/Bug45961Test.java Tue Dec 15 17:13:17 2015
@@ -41,7 +41,7 @@ import org.w3c.dom.NodeList;
public class Bug45961Test extends org.junit.Assert {
private static final String OBJECT_ID = "Object";
- private static final String MOCK_CANONICALIZATION_METHOD =
+ private static final String MOCK_CANONICALIZATION_METHOD =
MockCanonicalizationMethod.MOCK_CANONICALIZATION_METHOD;
private static final char[] PASSWORD = "changeit".toCharArray();
private static final String ALIAS = "mullan";
@@ -58,7 +58,7 @@ public class Bug45961Test extends org.ju
@org.junit.Test
public void testBug() throws Exception {
Document document = getSignedDocument();
- NodeList list =
+ NodeList list =
document.getElementsByTagNameNS(Constants.SignatureSpecNS, Constants._TAG_SIGNATURE);
Element element = (Element) list.item(0);
XMLSignature signature = new XMLSignature(element, null);
@@ -74,7 +74,7 @@ public class Bug45961Test extends org.ju
private Document getSignedDocument() throws Exception {
KeyStore ks = KeyStore.getInstance("JKS");
- FileInputStream fis =
+ FileInputStream fis =
new FileInputStream(getAbsolutePath("src/test/resources/test.jks"));
ks.load(fis, PASSWORD);
fis.close();
@@ -123,5 +123,5 @@ public class Bug45961Test extends org.ju
}
return path;
}
-
+
}
Modified: santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/c14n/implementations/Canonicalizer11Test.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/c14n/implementations/Canonicalizer11Test.java?rev=1720201&r1=1720200&r2=1720201&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/c14n/implementations/Canonicalizer11Test.java (original)
+++ santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/c14n/implementations/Canonicalizer11Test.java Tue Dec 15 17:13:17 2015
@@ -45,7 +45,7 @@ import org.w3c.dom.NodeList;
import org.xml.sax.SAXException;
/**
- * Unit test for
+ * Unit test for
* {@link org.apache.xml.security.c14n.implementations.Canonicalizer11}
*/
public class Canonicalizer11Test extends org.junit.Assert {
@@ -56,10 +56,10 @@ public class Canonicalizer11Test extends
static {
org.apache.xml.security.Init.init();
}
-
+
/** Field prefix */
private String prefix;
-
+
public Canonicalizer11Test() {
prefix = "src/test/resources/org/apache/xml/security/c14n/";
String basedir = System.getProperty("basedir");
@@ -78,7 +78,7 @@ public class Canonicalizer11Test extends
* @throws ParserConfigurationException
* @throws SAXException
* @throws TransformerException
- * @throws XPathExpressionException
+ * @throws XPathExpressionException
*/
@org.junit.Test
public void test31withCommentsSubtree()
@@ -98,7 +98,7 @@ public class Canonicalizer11Test extends
assertTrue(descri,
c14nAndCompare(fileIn, fileRef, fileOut, c14nURI, validating, xpath));
}
-
+
/**
* 3.2 Whitespace in Document Content
*
@@ -110,7 +110,7 @@ public class Canonicalizer11Test extends
* @throws SAXException
* @see <A HREF="http://www.w3.org/TR/2001/PR-xml-c14n-20010119#Example-WhitespaceInContent">the example from the spec</A>
* @throws TransformerException
- * @throws XPathExpressionException
+ * @throws XPathExpressionException
*/
@org.junit.Test
public void test32subtree()
@@ -140,7 +140,7 @@ public class Canonicalizer11Test extends
* @throws SAXException
* @see <A HREF="http://www.w3.org/TR/2001/PR-xml-c14n-20010119#Example-SETags">the example from the spec</A>
* @throws TransformerException
- * @throws XPathExpressionException
+ * @throws XPathExpressionException
*/
@org.junit.Test
public void test33subtree()
@@ -171,7 +171,7 @@ public class Canonicalizer11Test extends
* @see #test34validatingParser
* @see <A HREF="http://www.w3.org/TR/2001/PR-xml-c14n-20010119#Example-Chars">the example from the spec</A>
* @throws TransformerException
- * @throws XPathExpressionException
+ * @throws XPathExpressionException
*/
@org.junit.Test
public void test34()
@@ -202,7 +202,7 @@ public class Canonicalizer11Test extends
* @throws SAXException
* @see <A HREF="http://www.w3.org/TR/2001/PR-xml-c14n-20010119#Example-Entities">the example from the spec</A>
* @throws TransformerException
- * @throws XPathExpressionException
+ * @throws XPathExpressionException
*/
@org.junit.Test
public void test35subtree()
@@ -220,7 +220,7 @@ public class Canonicalizer11Test extends
assertTrue(descri,
c14nAndCompare(fileIn, fileRef, fileOut, c14nURI, validating, xpath));
}
-
+
/**
* 3.6 UTF-8 Encoding
*
@@ -232,7 +232,7 @@ public class Canonicalizer11Test extends
* @throws SAXException
* @see <A HREF="http://www.w3.org/TR/2001/PR-xml-c14n-20010119#Example-UTF8">the example from the spec</A>
* @throws TransformerException
- * @throws XPathExpressionException
+ * @throws XPathExpressionException
*/
@org.junit.Test
public void test36subtree()
@@ -250,7 +250,7 @@ public class Canonicalizer11Test extends
assertTrue(descri,
c14nAndCompare(fileIn, fileRef, fileOut, c14nURI, validating, xpath));
}
-
+
/**
* 3.7 Document Subsets
*
@@ -262,7 +262,7 @@ public class Canonicalizer11Test extends
* @throws SAXException
* @see <A HREF="http://www.w3.org/TR/2001/PR-xml-c14n-20010119#Example-DocSubsets">the example from the spec</A>
* @throws TransformerException
- * @throws XPathExpressionException
+ * @throws XPathExpressionException
*/
@org.junit.Test
public void test37()
@@ -289,7 +289,7 @@ public class Canonicalizer11Test extends
assertTrue(descri,
c14nAndCompare(fileIn, fileRef, fileOut, c14nURI, validating, xpath, namespace));
}
-
+
/**
* 3.8 Document Subsets and XML Attributes
*
@@ -300,7 +300,7 @@ public class Canonicalizer11Test extends
* @throws ParserConfigurationException
* @throws SAXException
* @throws TransformerException
- * @throws XPathExpressionException
+ * @throws XPathExpressionException
*/
@org.junit.Test
public void test38()
@@ -329,25 +329,25 @@ public class Canonicalizer11Test extends
}
private boolean c14nAndCompare(
- String fileIn,
- String fileRef,
- String fileOut,
- String c14nURI,
+ String fileIn,
+ String fileRef,
+ String fileOut,
+ String c14nURI,
boolean validating,
String xpath
) throws IOException, FileNotFoundException, SAXException,
ParserConfigurationException, CanonicalizationException,
InvalidCanonicalizerException, TransformerException, XPathExpressionException {
Map<String, String> namespace = new HashMap<String, String>();
- return c14nAndCompare(fileIn, fileRef, fileOut,
+ return c14nAndCompare(fileIn, fileRef, fileOut,
c14nURI, validating, xpath, namespace);
}
-
+
private boolean c14nAndCompare(
- String fileIn,
- String fileRef,
- String fileOut,
- String c14nURI,
+ String fileIn,
+ String fileRef,
+ String fileOut,
+ String c14nURI,
boolean validating,
String xpath,
Map<String, String> namespaces
@@ -374,7 +374,7 @@ public class Canonicalizer11Test extends
c14nBytes = c14n.canonicalizeSubtree(doc);
} else {
NodeList nl = null;
-
+
XPathFactory xpf = XPathFactory.newInstance();
XPath xPath = xpf.newXPath();
DSNamespaceContext namespaceContext =
@@ -393,7 +393,7 @@ public class Canonicalizer11Test extends
// if everything is OK, result is true; we do a binary compare, byte by byte
boolean result = java.security.MessageDigest.isEqual(refBytes, c14nBytes);
- if (!result) {
+ if (!result) {
File f = new File(fileOut);
if (!f.exists()) {
File parent = new File(f.getParent());
Modified: santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/c14n/implementations/Canonicalizer20010315ExclusiveTest.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/c14n/implementations/Canonicalizer20010315ExclusiveTest.java?rev=1720201&r1=1720200&r2=1720201&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/c14n/implementations/Canonicalizer20010315ExclusiveTest.java (original)
+++ santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/c14n/implementations/Canonicalizer20010315ExclusiveTest.java Tue Dec 15 17:13:17 2015
@@ -274,7 +274,7 @@ public class Canonicalizer20010315Exclus
* @throws TransformerException
* @throws XMLSecurityException
* @throws XMLSignatureException
- * @throws XPathExpressionException
+ * @throws XPathExpressionException
*/
@org.junit.Test
public void test223excl()
@@ -291,7 +291,7 @@ public class Canonicalizer20010315Exclus
xpath.setNamespaceContext(new DSNamespaceContext());
String expression = "(//. | //@* | //namespace::*)[ancestor-or-self::p]";
- NodeList nodes =
+ NodeList nodes =
(NodeList) xpath.evaluate(expression, doc, XPathConstants.NODESET);
Canonicalizer20010315Excl c = new Canonicalizer20010315ExclWithComments();
@@ -304,7 +304,7 @@ public class Canonicalizer20010315Exclus
}
/**
- * Tests node-set as input. See bug 37708.
+ * Tests node-set as input. See bug 37708.
* Provided by Pete Hendry.
*/
@org.junit.Test
@@ -336,7 +336,7 @@ public class Canonicalizer20010315Exclus
+ "</env:Body>";
Document doc = this.db.parse(new InputSource(new StringReader(XML)));
- Canonicalizer20010315ExclOmitComments c14n =
+ Canonicalizer20010315ExclOmitComments c14n =
new Canonicalizer20010315ExclOmitComments();
Set<Node> nodeSet = new HashSet<Node>();
XMLUtils.getSet(doc.getDocumentElement().getFirstChild(), nodeSet, null, false);
@@ -344,9 +344,9 @@ public class Canonicalizer20010315Exclus
byte[] bytes = c14n.engineCanonicalize(input, "env ns0 xsi wsu");
assertEquals(c14nXML, new String(bytes));
}
-
+
/**
- * Method test24excl - a testcase for SANTUARIO-263
+ * Method test24excl - a testcase for SANTUARIO-263
* "Canonicalizer can't handle dynamical created DOM correctly"
* https://issues.apache.org/jira/browse/SANTUARIO-263
*/
@@ -356,10 +356,10 @@ public class Canonicalizer20010315Exclus
this.db.parse(
getAbsolutePath(
"src/test/resources/org/apache/xml/security/c14n/inExcl/example2_4.xml"));
- Node root =
+ Node root =
doc.getElementsByTagNameNS("http://example.net", "elem2").item(0);
Canonicalizer20010315Excl c = new Canonicalizer20010315ExclWithComments();
- byte[] reference =
+ byte[] reference =
JavaUtils.getBytesFromFile(getAbsolutePath(
"src/test/resources/org/apache/xml/security/c14n/inExcl/example2_4_c14nized.xml"));
byte[] result = c.engineCanonicalizeSubTree(root);
@@ -369,7 +369,7 @@ public class Canonicalizer20010315Exclus
}
/**
- * Method test24Aexcl - a testcase for SANTUARIO-263
+ * Method test24Aexcl - a testcase for SANTUARIO-263
* "Canonicalizer can't handle dynamical created DOM correctly"
* https://issues.apache.org/jira/browse/SANTUARIO-263
*/
@@ -387,7 +387,7 @@ public class Canonicalizer20010315Exclus
Node root = doc.getElementsByTagNameNS("http://example.net", "elem2").item(0);
Canonicalizer20010315Excl c = new Canonicalizer20010315ExclWithComments();
- byte[] reference =
+ byte[] reference =
JavaUtils.getBytesFromFile(getAbsolutePath(
"src/test/resources/org/apache/xml/security/c14n/inExcl/example2_4_c14nized.xml"));
byte[] result = c.engineCanonicalizeSubTree(root);