diff --git a/.gitignore b/.gitignore
index 7477aada..185cdbc6 100644
--- a/.gitignore
+++ b/.gitignore
@@ -7,7 +7,6 @@ p.txt
*.*~
*.swp
npm-debug.log
-/test/validators/XmlCryptoJava/target/
.eslintcache
.nyc_output/
coverage/
diff --git a/.prettierignore b/.prettierignore
index 11e7ea11..968e7cba 100644
--- a/.prettierignore
+++ b/.prettierignore
@@ -5,6 +5,5 @@ package-lock.json
.eslintcache
.prettierignore
test/static/*
-test/validators/*
.nyc_output/*
coverage/*
diff --git a/AGENTS.md b/AGENTS.md
index d027164f..225f4ea8 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -12,7 +12,7 @@ an authentication bypass downstream. Treat every change as security-relevant.
- `src/index.ts` — the public barrel. Anything re-exported here is public API.
- `src/signed-xml.ts` — the core signing and verification logic.
- `test/*.spec.ts` — Mocha specs.
-- `test/static/`, `test/validators/` — fixtures. See the warning below.
+- `test/static/` — fixtures. See the warning below.
- `lib/` — build output. Generated; never edit.
## Commands
@@ -28,10 +28,10 @@ Run `npm run build && npm test && npm run lint` before calling work done.
### Fixtures are byte-sensitive
-`test/static/` and `test/validators/` contain XML signature fixtures. Canonicalization
-and digests depend on the exact bytes, so reformatting whitespace silently invalidates
-signatures and the failure can look unrelated. `.prettierignore` excludes both
-directories — keep it that way, and never run a formatter over them.
+`test/static/` contains XML signature fixtures. Canonicalization and digests depend on
+the exact bytes, so reformatting whitespace silently invalidates signatures and the
+failure can look unrelated. `.prettierignore` excludes that directory — keep it that
+way, and never run a formatter over it.
### The supported Node floor is real
diff --git a/test/README.md b/test/README.md
new file mode 100644
index 00000000..48eb265e
--- /dev/null
+++ b/test/README.md
@@ -0,0 +1,33 @@
+# Tests
+
+- `*.spec.ts` — the Mocha suite. Run with `npm test` from the repository root.
+- `static/` — signature fixtures.
+- `static/integration/` — fixtures for the integration specs.
+
+## Fixture provenance
+
+Most fixtures under `static/` are signatures this library produced and now asserts
+against, but some were generated by other XML-DSig implementations so that the suite
+checks interoperability rather than only self-consistency. Those were generated once and
+frozen; the tests compare against the recorded bytes, so no second toolchain is needed to
+run them.
+
+- `hmac_signature.xml`, `hmac.key`, `hmac-foobar.key` — produced by the JDK's
+ `javax.xml.crypto.dsig` implementation (Apache Santuario), added alongside HMAC
+ verification support in `c6f7aaa`.
+- `windows_store_signature.xml` — a Windows Store receipt, signed by
+ `System.Security.Cryptography.Xml.SignedXml` on .NET Framework.
+
+Two throwaway harnesses used to live in `test/validators/` for this cross-checking: a C#
+console project driving .NET's `SignedXml`, and a Maven project driving the JDK's
+`XMLSignatureFactory`. Neither was run by CI or any npm script, and parts of the C# one
+no longer compiled. They were removed in 7.0; see
+[#547](https://github.com/node-saml/xml-crypto/issues/547). Recover them from history
+with `git show 0409418:test/validators` if a fixture ever needs regenerating.
+
+## Fixtures are byte-sensitive
+
+Canonicalization and digests depend on the exact bytes of these files, so reformatting
+whitespace silently invalidates a signature and the resulting failure can look unrelated.
+`.prettierignore` excludes `test/static/` — keep it that way, and never run a formatter
+over it.
diff --git a/test/validators/XmlCryptoJava/pom.xml b/test/validators/XmlCryptoJava/pom.xml
deleted file mode 100644
index dd19e2a3..00000000
--- a/test/validators/XmlCryptoJava/pom.xml
+++ /dev/null
@@ -1,72 +0,0 @@
-
-
- 4.0.0
- XML Crypto Java Tests
- org.nodejs
- xml-crypto-java
- 1.0.0-SNAPSHOT
- jar
- 2015
-
-
- MIT License
- http://www.opensource.org/licenses/mit-license.php
-
-
-
-
- fcorneli
- Frank Cornelis
- info@e-contract.be
-
-
-
-
- junit
- junit
- 4.13.1
- test
-
-
- org.slf4j
- slf4j-api
- 1.7.12
- test
-
-
- org.slf4j
- slf4j-log4j12
- 1.7.12
- test
-
-
- log4j
- log4j
- 1.2.17
- test
-
-
- commons-io
- commons-io
- 2.7
- test
-
-
-
-
-
- org.apache.maven.plugins
- maven-compiler-plugin
- 3.3
-
- 1.7
- 1.7
- UTF-8
-
-
-
-
-
- UTF-8
-
-
diff --git a/test/validators/XmlCryptoJava/src/test/java/org/nodejs/xmlcrypto/HMACTest.java b/test/validators/XmlCryptoJava/src/test/java/org/nodejs/xmlcrypto/HMACTest.java
deleted file mode 100644
index b1000254..00000000
--- a/test/validators/XmlCryptoJava/src/test/java/org/nodejs/xmlcrypto/HMACTest.java
+++ /dev/null
@@ -1,119 +0,0 @@
-package org.nodejs.xmlcrypto;
-
-import java.io.File;
-import java.util.Collections;
-import java.util.LinkedList;
-import java.util.List;
-import javax.crypto.KeyGenerator;
-import javax.crypto.SecretKey;
-import javax.xml.crypto.dsig.CanonicalizationMethod;
-import javax.xml.crypto.dsig.DigestMethod;
-import javax.xml.crypto.dsig.Reference;
-import javax.xml.crypto.dsig.SignatureMethod;
-import javax.xml.crypto.dsig.SignedInfo;
-import javax.xml.crypto.dsig.Transform;
-import javax.xml.crypto.dsig.XMLSignature;
-import javax.xml.crypto.dsig.XMLSignatureFactory;
-import javax.xml.crypto.dsig.dom.DOMSignContext;
-import javax.xml.crypto.dsig.keyinfo.KeyInfo;
-import javax.xml.crypto.dsig.keyinfo.KeyInfoFactory;
-import javax.xml.crypto.dsig.spec.C14NMethodParameterSpec;
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.transform.Transformer;
-import javax.xml.transform.TransformerFactory;
-import javax.xml.transform.dom.DOMSource;
-import javax.xml.transform.stream.StreamResult;
-import org.apache.commons.io.FileUtils;
-import org.junit.Test;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-
-public class HMACTest {
-
- public static final String NamespaceSpecNS = "http://www.w3.org/2000/xmlns/";
-
- private static final Logger LOGGER = LoggerFactory
- .getLogger(HMACTest.class);
-
- @Test
- public void testCreateHMACSignature() throws Exception {
- // generate key
- KeyGenerator keyGenerator = KeyGenerator.getInstance("HmacSHA1");
- SecretKey secretKey = keyGenerator.generateKey();
-
- // generate DOM document
- DocumentBuilderFactory documentBuilderFactory
- = DocumentBuilderFactory.newInstance();
- documentBuilderFactory.setNamespaceAware(true);
- DocumentBuilder documentBuilder = documentBuilderFactory
- .newDocumentBuilder();
- Document document = documentBuilder.newDocument();
- Element rootElement = document.createElementNS("urn:test",
- "test:Root");
- rootElement.setAttributeNS(NamespaceSpecNS,
- "xmlns:test", "urn:test");
- document.appendChild(rootElement);
-
- XMLSignatureFactory xmlSignatureFactory = XMLSignatureFactory
- .getInstance("DOM");
-
- // XML Signature references
- List references = new LinkedList<>();
- List transforms = new LinkedList<>();
- Transform envTransform = xmlSignatureFactory.newTransform(
- CanonicalizationMethod.ENVELOPED,
- (C14NMethodParameterSpec) null);
- transforms.add(envTransform);
- Transform exclTransform = xmlSignatureFactory.newTransform(
- CanonicalizationMethod.EXCLUSIVE,
- (C14NMethodParameterSpec) null);
- transforms.add(exclTransform);
- Reference reference = xmlSignatureFactory.newReference("",
- xmlSignatureFactory.newDigestMethod(DigestMethod.SHA256,
- null), transforms, null, null);
- references.add(reference);
-
- // XML Signature SignedInfo
- SignedInfo signedInfo = xmlSignatureFactory.newSignedInfo(
- xmlSignatureFactory.newCanonicalizationMethod(
- CanonicalizationMethod.EXCLUSIVE,
- (C14NMethodParameterSpec) null),
- xmlSignatureFactory.newSignatureMethod(
- SignatureMethod.HMAC_SHA1,
- null), references);
-
- // XML Signature KeyInfo
- KeyInfoFactory keyInfoFactory
- = xmlSignatureFactory.getKeyInfoFactory();
- KeyInfo keyInfo = keyInfoFactory.newKeyInfo(Collections
- .singletonList(keyInfoFactory.newKeyName("some-key-name")));
-
- Element parentElement = document.getDocumentElement();
- DOMSignContext domSignContext = new DOMSignContext(
- secretKey, parentElement);
- domSignContext.setDefaultNamespacePrefix("ds");
- XMLSignature xmlSignature = xmlSignatureFactory.newXMLSignature(
- signedInfo, keyInfo);
- xmlSignature.sign(domSignContext);
-
- File tmpFile = File.createTempFile("xml-signature-hmac-", ".xml");
- LOGGER.debug("XML signature file: {}", tmpFile.getAbsolutePath());
- toFile(document, tmpFile);
-
- File tmpKeyFile = File.createTempFile("hmac-", ".key");
- FileUtils.writeByteArrayToFile(tmpKeyFile, secretKey.getEncoded());
- LOGGER.debug("key file: {}", tmpKeyFile.getAbsolutePath());
-
- }
-
- private void toFile(Node node, File file) throws Exception {
- TransformerFactory transformerFactory = TransformerFactory
- .newInstance();
- Transformer transformer = transformerFactory.newTransformer();
- transformer.transform(new DOMSource(node), new StreamResult(file));
- }
-}
diff --git a/test/validators/XmlCryptoJava/src/test/resources/log4j.xml b/test/validators/XmlCryptoJava/src/test/resources/log4j.xml
deleted file mode 100644
index 277b7d09..00000000
--- a/test/validators/XmlCryptoJava/src/test/resources/log4j.xml
+++ /dev/null
@@ -1,16 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/test/validators/XmlCryptoUtilities/XmlCryptoUtilities.sln b/test/validators/XmlCryptoUtilities/XmlCryptoUtilities.sln
deleted file mode 100644
index 9f997a1e..00000000
--- a/test/validators/XmlCryptoUtilities/XmlCryptoUtilities.sln
+++ /dev/null
@@ -1,20 +0,0 @@
-
-Microsoft Visual Studio Solution File, Format Version 11.00
-# Visual Studio 2010
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ValidateSignature", "XmlCryptoUtilities\ValidateSignature.csproj", "{CAA449E3-720D-4CD6-B03B-94991E11FF25}"
-EndProject
-Global
- GlobalSection(SolutionConfigurationPlatforms) = preSolution
- Debug|x86 = Debug|x86
- Release|x86 = Release|x86
- EndGlobalSection
- GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {CAA449E3-720D-4CD6-B03B-94991E11FF25}.Debug|x86.ActiveCfg = Debug|x86
- {CAA449E3-720D-4CD6-B03B-94991E11FF25}.Debug|x86.Build.0 = Debug|x86
- {CAA449E3-720D-4CD6-B03B-94991E11FF25}.Release|x86.ActiveCfg = Release|x86
- {CAA449E3-720D-4CD6-B03B-94991E11FF25}.Release|x86.Build.0 = Release|x86
- EndGlobalSection
- GlobalSection(SolutionProperties) = preSolution
- HideSolutionNode = FALSE
- EndGlobalSection
-EndGlobal
diff --git a/test/validators/XmlCryptoUtilities/XmlCryptoUtilities.suo b/test/validators/XmlCryptoUtilities/XmlCryptoUtilities.suo
deleted file mode 100644
index 0c402ac6..00000000
Binary files a/test/validators/XmlCryptoUtilities/XmlCryptoUtilities.suo and /dev/null differ
diff --git a/test/validators/XmlCryptoUtilities/XmlCryptoUtilities/Program.cs b/test/validators/XmlCryptoUtilities/XmlCryptoUtilities/Program.cs
deleted file mode 100644
index 6c4c48e6..00000000
--- a/test/validators/XmlCryptoUtilities/XmlCryptoUtilities/Program.cs
+++ /dev/null
@@ -1,140 +0,0 @@
-//
-// This example signs an XML file using an
-// envelope signature. It then verifies the
-// signed XML.
-//
-using System;
-using System.Security.Cryptography;
-using System.Security.Cryptography.X509Certificates;
-using System.Security.Cryptography.Xml;
-using System.Text;
-using System.Xml;
-using System.IO;
-using System.Reflection;
-
-public class SignVerifyEnvelope
-{
-
- public static void Main(String[] args)
- {
- var exe = Assembly.GetExecutingAssembly().Location;
- var folder = Path.GetDirectoryName(exe);
- var pfx = Path.Combine(folder, "ClientPrivate.pfx");
- var c = new X509Certificate2(File.ReadAllBytes(pfx), "wse2qs");
-
- if (args[0] == "verify")
- {
- Console.WriteLine("verifying signature...");
- var file = Path.Combine(folder, "SignedExample.xml");
- bool b = VerifyXmlFile(file, (RSA)c.PublicKey.Key);
- Console.WriteLine("signature is " + (b ? "valid" : "not valid!"));
- if (!b) Environment.Exit(-1);
- }
- else if (args[0] == "sign")
- {
- Console.WriteLine("generating signature...");
- var xmlFile = Path.Combine(folder, "Example.xml");
- var sigFile = Path.Combine(folder, "signedExample.xml");
- CreateSomeXml(xmlFile);
- SignXmlFile(xmlFile, sigFile, (RSA)c.PrivateKey);
- Console.WriteLine("done");
- }
- }
-
- // Sign an XML file and save the signature in a new file. This method does not
- // save the public key within the XML file. This file cannot be verified unless
- // the verifying code has the key with which it was signed.
- public static void SignXmlFile(string FileName, string SignedFileName, RSA Key)
- {
- // Create a new XML document.
- XmlDocument doc = new XmlDocument();
-
- // Load the passed XML file using its name.
- doc.Load(new XmlTextReader(FileName));
-
- // Create a SignedXml object.
- SignedXml signedXml = new SignedXml(doc);
-
- // Add the key to the SignedXml document.
- signedXml.SigningKey = Key;
-
- // Create a reference to be signed.
- Reference reference = new Reference();
- reference.Uri = "";
-
- // Add an enveloped transformation to the reference.
- XmlDsigEnvelopedSignatureTransform env = new XmlDsigEnvelopedSignatureTransform();
- reference.AddTransform(env);
-
- // Add the reference to the SignedXml object.
- signedXml.AddReference(reference);
-
- // Compute the signature.
- signedXml.ComputeSignature();
-
- // Get the XML representation of the signature and save
- // it to an XmlElement object.
- XmlElement xmlDigitalSignature = signedXml.GetXml();
-
- // Append the element to the XML document.
- doc.DocumentElement.AppendChild(doc.ImportNode(xmlDigitalSignature, true));
-
- if (doc.FirstChild is XmlDeclaration)
- {
- doc.RemoveChild(doc.FirstChild);
- }
-
- // Save the signed XML document to a file specified
- // using the passed string.
- XmlTextWriter xmltw = new XmlTextWriter(SignedFileName, new UTF8Encoding(false));
- doc.WriteTo(xmltw);
- xmltw.Close();
- }
-
- // Verify the signature of an XML file against an asymetric
- // algorithm and return the result.
- public static Boolean VerifyXmlFile(String Name, RSA Key)
- {
- // Create a new XML document.
- XmlDocument xmlDocument = new XmlDocument();
-
- // Load the passed XML file into the document.
- xmlDocument.Load(Name);
-
- // Create a new SignedXml object and pass it
- // the XML document class.
- SignedXml signedXml = new SignedXml(xmlDocument);
-
- // Find the "Signature" node and create a new
- // XmlNodeList object.
- XmlNodeList nodeList = xmlDocument.GetElementsByTagName("Signature");
-
- // Load the signature node.
- signedXml.LoadXml((XmlElement)nodeList[0]);
-
- // Check the signature and return the result.
- return signedXml.CheckSignature(Key);
- }
-
-
- // Create example data to sign.
- public static void CreateSomeXml(string FileName)
- {
- // Create a new XmlDocument object.
- XmlDocument document = new XmlDocument();
-
- // Create a new XmlNode object.
- XmlNode node = document.CreateNode(XmlNodeType.Element, "", "MyElement", "samples");
-
- // Add some text to the node.
- node.InnerText = "Example text to be signed.";
-
- // Append the node to the document.
- document.AppendChild(node);
-
- // Save the XML document to the file name specified.
- XmlTextWriter xmltw = new XmlTextWriter(FileName, new UTF8Encoding(false));
- document.WriteTo(xmltw);
- xmltw.Close();
- }
-}
diff --git a/test/validators/XmlCryptoUtilities/XmlCryptoUtilities/Properties/AssemblyInfo.cs b/test/validators/XmlCryptoUtilities/XmlCryptoUtilities/Properties/AssemblyInfo.cs
deleted file mode 100644
index 4f4c9558..00000000
--- a/test/validators/XmlCryptoUtilities/XmlCryptoUtilities/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,36 +0,0 @@
-using System.Reflection;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-
-// General Information about an assembly is controlled through the following
-// set of attributes. Change these attribute values to modify the information
-// associated with an assembly.
-[assembly: AssemblyTitle("XmlCryptoUtilities")]
-[assembly: AssemblyDescription("")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("Microsoft")]
-[assembly: AssemblyProduct("XmlCryptoUtilities")]
-[assembly: AssemblyCopyright("Copyright © Microsoft 2012")]
-[assembly: AssemblyTrademark("")]
-[assembly: AssemblyCulture("")]
-
-// Setting ComVisible to false makes the types in this assembly not visible
-// to COM components. If you need to access a type in this assembly from
-// COM, set the ComVisible attribute to true on that type.
-[assembly: ComVisible(false)]
-
-// The following GUID is for the ID of the typelib if this project is exposed to COM
-[assembly: Guid("8305ddd7-a079-45b3-8db1-83728172475e")]
-
-// Version information for an assembly consists of the following four values:
-//
-// Major Version
-// Minor Version
-// Build Number
-// Revision
-//
-// You can specify all the values or you can default the Build and Revision Numbers
-// by using the '*' as shown below:
-// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.0.0.0")]
-[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/test/validators/XmlCryptoUtilities/XmlCryptoUtilities/ValidateSignature.csproj b/test/validators/XmlCryptoUtilities/XmlCryptoUtilities/ValidateSignature.csproj
deleted file mode 100644
index f549d460..00000000
--- a/test/validators/XmlCryptoUtilities/XmlCryptoUtilities/ValidateSignature.csproj
+++ /dev/null
@@ -1,59 +0,0 @@
-
-
-
- Debug
- x86
- 8.0.30703
- 2.0
- {CAA449E3-720D-4CD6-B03B-94991E11FF25}
- Exe
- Properties
- XmlCryptoUtilities
- XmlCryptoUtilities
- v4.0
- Client
- 512
-
-
- x86
- true
- full
- false
- bin\Debug\
- DEBUG;TRACE
- prompt
- 4
-
-
- x86
- pdbonly
- true
- bin\Release\
- TRACE
- prompt
- 4
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/test/validators/XmlCryptoUtilities/XmlCryptoUtilities/bin/Debug/ClientPrivate.pfx b/test/validators/XmlCryptoUtilities/XmlCryptoUtilities/bin/Debug/ClientPrivate.pfx
deleted file mode 100644
index c0e53156..00000000
Binary files a/test/validators/XmlCryptoUtilities/XmlCryptoUtilities/bin/Debug/ClientPrivate.pfx and /dev/null differ
diff --git a/test/validators/XmlCryptoUtilities/XmlCryptoUtilities/bin/Debug/Example.xml b/test/validators/XmlCryptoUtilities/XmlCryptoUtilities/bin/Debug/Example.xml
deleted file mode 100644
index 93e8344a..00000000
--- a/test/validators/XmlCryptoUtilities/XmlCryptoUtilities/bin/Debug/Example.xml
+++ /dev/null
@@ -1 +0,0 @@
-Example text to be signed.
\ No newline at end of file
diff --git a/test/validators/XmlCryptoUtilities/XmlCryptoUtilities/bin/Debug/XmlCryptoUtilities.exe b/test/validators/XmlCryptoUtilities/XmlCryptoUtilities/bin/Debug/XmlCryptoUtilities.exe
deleted file mode 100644
index 89068c26..00000000
Binary files a/test/validators/XmlCryptoUtilities/XmlCryptoUtilities/bin/Debug/XmlCryptoUtilities.exe and /dev/null differ
diff --git a/test/validators/XmlCryptoUtilities/XmlCryptoUtilities/bin/Debug/XmlCryptoUtilities.pdb b/test/validators/XmlCryptoUtilities/XmlCryptoUtilities/bin/Debug/XmlCryptoUtilities.pdb
deleted file mode 100644
index 584aebb1..00000000
Binary files a/test/validators/XmlCryptoUtilities/XmlCryptoUtilities/bin/Debug/XmlCryptoUtilities.pdb and /dev/null differ
diff --git a/test/validators/XmlCryptoUtilities/XmlCryptoUtilities/bin/Debug/XmlCryptoUtilities.vshost.exe b/test/validators/XmlCryptoUtilities/XmlCryptoUtilities/bin/Debug/XmlCryptoUtilities.vshost.exe
deleted file mode 100644
index bb84a51a..00000000
Binary files a/test/validators/XmlCryptoUtilities/XmlCryptoUtilities/bin/Debug/XmlCryptoUtilities.vshost.exe and /dev/null differ
diff --git a/test/validators/XmlCryptoUtilities/XmlCryptoUtilities/bin/Debug/XmlCryptoUtilities.vshost.exe.manifest b/test/validators/XmlCryptoUtilities/XmlCryptoUtilities/bin/Debug/XmlCryptoUtilities.vshost.exe.manifest
deleted file mode 100644
index 061c9ca9..00000000
--- a/test/validators/XmlCryptoUtilities/XmlCryptoUtilities/bin/Debug/XmlCryptoUtilities.vshost.exe.manifest
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
diff --git a/test/validators/XmlCryptoUtilities/XmlCryptoUtilities/bin/Debug/signedExample.xml b/test/validators/XmlCryptoUtilities/XmlCryptoUtilities/bin/Debug/signedExample.xml
deleted file mode 100644
index f37ef429..00000000
--- a/test/validators/XmlCryptoUtilities/XmlCryptoUtilities/bin/Debug/signedExample.xml
+++ /dev/null
@@ -1 +0,0 @@
-Harry PotterJoanne KRowlingVXkWV6BNrUKqdmwcxhIgRa86HUI=Y71mpTZ0Ba5qED2TxHLp34tq8Pa9X41M5PuABwPq7r2GaL5Ib28ELkhMtnZuZboO50bxh/9fwK6DPApP92zUuOTZi4htlPcGJRP5kvHznbwzvq7aO5FWAcpUTX+yMrlERIutiJi7mjChX+mIKF5/4DK66JfIlY5vlq61TX2gaJw=
\ No newline at end of file
diff --git a/test/validators/XmlCryptoUtilities/XmlCryptoUtilities/obj/x86/Debug/DesignTimeResolveAssemblyReferencesInput.cache b/test/validators/XmlCryptoUtilities/XmlCryptoUtilities/obj/x86/Debug/DesignTimeResolveAssemblyReferencesInput.cache
deleted file mode 100644
index f1e0ed56..00000000
Binary files a/test/validators/XmlCryptoUtilities/XmlCryptoUtilities/obj/x86/Debug/DesignTimeResolveAssemblyReferencesInput.cache and /dev/null differ
diff --git a/test/validators/XmlCryptoUtilities/XmlCryptoUtilities/obj/x86/Debug/ValidateSignature.csproj.FileListAbsolute.txt b/test/validators/XmlCryptoUtilities/XmlCryptoUtilities/obj/x86/Debug/ValidateSignature.csproj.FileListAbsolute.txt
deleted file mode 100644
index b3460171..00000000
--- a/test/validators/XmlCryptoUtilities/XmlCryptoUtilities/obj/x86/Debug/ValidateSignature.csproj.FileListAbsolute.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-C:\Users\naveh\Documents\features\projects\xml-crypto\test\validators\XmlCryptoUtilities\XmlCryptoUtilities\bin\Debug\XmlCryptoUtilities.exe
-C:\Users\naveh\Documents\features\projects\xml-crypto\test\validators\XmlCryptoUtilities\XmlCryptoUtilities\bin\Debug\XmlCryptoUtilities.pdb
-C:\Users\naveh\Documents\features\projects\xml-crypto\test\validators\XmlCryptoUtilities\XmlCryptoUtilities\obj\x86\Debug\ResolveAssemblyReference.cache
-C:\Users\naveh\Documents\features\projects\xml-crypto\test\validators\XmlCryptoUtilities\XmlCryptoUtilities\obj\x86\Debug\XmlCryptoUtilities.exe
-C:\Users\naveh\Documents\features\projects\xml-crypto\test\validators\XmlCryptoUtilities\XmlCryptoUtilities\obj\x86\Debug\XmlCryptoUtilities.pdb
diff --git a/test/validators/XmlCryptoUtilities/XmlCryptoUtilities/obj/x86/Debug/XmlCryptoUtilities.exe b/test/validators/XmlCryptoUtilities/XmlCryptoUtilities/obj/x86/Debug/XmlCryptoUtilities.exe
deleted file mode 100644
index 89068c26..00000000
Binary files a/test/validators/XmlCryptoUtilities/XmlCryptoUtilities/obj/x86/Debug/XmlCryptoUtilities.exe and /dev/null differ
diff --git a/test/validators/XmlCryptoUtilities/XmlCryptoUtilities/obj/x86/Debug/XmlCryptoUtilities.pdb b/test/validators/XmlCryptoUtilities/XmlCryptoUtilities/obj/x86/Debug/XmlCryptoUtilities.pdb
deleted file mode 100644
index 584aebb1..00000000
Binary files a/test/validators/XmlCryptoUtilities/XmlCryptoUtilities/obj/x86/Debug/XmlCryptoUtilities.pdb and /dev/null differ
diff --git a/test/validators/XmlCryptoUtilities/XmlCryptoUtilities/program-repro-misc-validation-and-canon.cs b/test/validators/XmlCryptoUtilities/XmlCryptoUtilities/program-repro-misc-validation-and-canon.cs
deleted file mode 100644
index f3eca86e..00000000
--- a/test/validators/XmlCryptoUtilities/XmlCryptoUtilities/program-repro-misc-validation-and-canon.cs
+++ /dev/null
@@ -1,278 +0,0 @@
-//
-// This example signs an XML file using an
-// envelope signature. It then verifies the
-// signed XML.
-//
-using System;
-using System.Security.Cryptography;
-using System.Security.Cryptography.X509Certificates;
-using System.Security.Cryptography.Xml;
-using System.Text;
-using System.Xml;
-using System.IO;
-using System.Reflection;
-
-public class SignVerifyEnvelope
-{
- public sealed class RSAPKCS1SHA256SignatureDescription : SignatureDescription
- {
- public RSAPKCS1SHA256SignatureDescription()
- {
- base.KeyAlgorithm = typeof(RSACryptoServiceProvider).FullName;
- base.DigestAlgorithm = typeof(SHA256Managed).FullName;
- base.FormatterAlgorithm = typeof(RSAPKCS1SignatureFormatter).FullName;
- base.DeformatterAlgorithm = typeof(RSAPKCS1SignatureDeformatter).FullName;
- }
-
- public override AsymmetricSignatureDeformatter CreateDeformatter(AsymmetricAlgorithm key)
- {
- if (key == null)
- {
- throw new ArgumentNullException("key");
- }
-
- RSAPKCS1SignatureDeformatter deformatter = new RSAPKCS1SignatureDeformatter(key);
- deformatter.SetHashAlgorithm("SHA256");
- return deformatter;
- }
-
- public override AsymmetricSignatureFormatter CreateFormatter(AsymmetricAlgorithm key)
- {
- if (key == null)
- {
- throw new ArgumentNullException("key");
- }
-
- RSAPKCS1SignatureFormatter formatter = new RSAPKCS1SignatureFormatter(key);
- formatter.SetHashAlgorithm("SHA256");
- return formatter;
- }
-
- }
-
-
- static bool ValidateXml(XmlDocument receipt, X509Certificate2 certificate)
- {
- // Create the signed XML object.
- SignedXml sxml = new SignedXml(receipt);
-
- // Get the XML Signature node and load it into the signed XML object.
- XmlNode dsig = receipt.GetElementsByTagName("Signature", SignedXml.XmlDsigNamespaceUrl)[0];
- if (dsig == null)
- {
- // If signature is not found return false
- System.Console.WriteLine("Signature not found.");
- return false;
- }
-
- sxml.LoadXml((XmlElement)dsig);
-
- // Check the signature
- bool isValid = sxml.CheckSignature(certificate, true);
-
-
- FieldInfo field = sxml.GetType().GetField("m_signature",
- BindingFlags.NonPublic |
- BindingFlags.Instance);
-
- var sig = (Signature)field.GetValue(sxml);
- var _ref = (Reference)sig.SignedInfo.References[0];
-
- //var pre = Type.GetType("System.Security.Cryptography.Xml.Utils").GetMethod("PreProcessDocumentInput");
- //pre.Invoke(null, new[] { });
-
-
- var enveloped = (XmlDsigEnvelopedSignatureTransform)_ref.TransformChain[0];
-
- enveloped.LoadInput(receipt);
- var outputstream = enveloped.GetOutput();
-
- var securityUrl = receipt.BaseURI;
- var resolver = new XmlSecureResolver(new XmlUrlResolver(), securityUrl);
- //TransformToOctetStream(Stream input, XmlResolver resolver, string baseUri)
- MethodInfo trans = _ref.TransformChain.GetType().GetMethods(BindingFlags.NonPublic | BindingFlags.Instance)[2];
-
- var stream = trans.Invoke(_ref.TransformChain, new object[] {receipt, resolver, securityUrl});
-
-
- var canontype = sig.GetType().Assembly.GetType("System.Security.Cryptography.Xml.CanonicalXml");
- var foo = Activator.CreateInstance(canontype, BindingFlags.NonPublic | BindingFlags.Instance, null, new object[] {receipt, resolver}, null);
-
-
-
-
-
-
- MethodInfo method = _ref.GetType().GetMethod("CalculateHashValue",
- BindingFlags.NonPublic |
- BindingFlags.Instance);
-
- FieldInfo refs = sig.GetType().GetField("m_referencedItems",
- BindingFlags.NonPublic |
- BindingFlags.Instance);
- var refs1 = refs.GetValue(sig);
-
- var res = method.Invoke(_ref, new [] {receipt, refs1});
- var str = Convert.ToBase64String((byte[])res);
-
- return isValid;
- }
-
-
- public static void Main(String[] args)
- {
-
-
- //calculate caninicalized xml
-
- var t = new XmlDsigEnvelopedSignatureTransform(false);
- XmlDocument doc = new XmlDocument();
- //doc.PreserveWhitespace = true;
- doc.Load(@"c:\temp\x.xml");
- t.LoadInput(doc);
-
-
- FieldInfo field = t.GetType().GetField("_signaturePosition",
- BindingFlags.NonPublic |
- BindingFlags.Instance);
-
-
- field.SetValue(t, 1);
-
- var res = (XmlDocument)t.GetOutput();
- var s = res.OuterXml;
-
- var c14 = new XmlDsigC14NTransform();
- c14.LoadInput(res);
- var mem = (MemoryStream)c14.GetOutput();
-
- var sha = new SHA256Managed();
-
- var byte1 = c14.GetDigestedOutput(new SHA256Managed());
- var digest1 = Convert.ToBase64String(byte1);
- var byte2 = sha.ComputeHash(mem.ToArray());
- var digest2 = Convert.ToBase64String(byte2);
-
-
- var s1 = System.Text.Encoding.UTF8.GetString(mem.ToArray());
- var byte3 = sha.ComputeHash(System.Text.Encoding.UTF8.GetBytes(s1));
- var digest3 = Convert.ToBase64String(byte3);
-
- //return;
-
-
-
- //validate signature
-
- CryptoConfig.AddAlgorithm(typeof(RSAPKCS1SHA256SignatureDescription), "http://www.w3.org/2001/04/xmldsig-more#rsa-sha256");
- XmlDocument xmlDoc = new XmlDocument();
- xmlDoc.Load(@"c:\temp\x.xml");
- XmlNode node = xmlDoc.DocumentElement;
- X509Certificate2 cert = new X509Certificate2(File.ReadAllBytes(@"c:\temp\x.cer"));
- bool isValid = ValidateXml(xmlDoc, cert);
- //return;
-
-
- //calc hash
- var sha1 = new SHA256Managed();
- var b1 = sha1.ComputeHash(System.Text.Encoding.UTF8.GetBytes(File.ReadAllText(@"c:\temp\x_no_sig.xml")));
- var b64 = Convert.ToBase64String(b1);
- }
-
- // Sign an XML file and save the signature in a new file. This method does not
- // save the public key within the XML file. This file cannot be verified unless
- // the verifying code has the key with which it was signed.
- public static void SignXmlFile(string FileName, string SignedFileName, RSA Key)
- {
- // Create a new XML document.
- XmlDocument doc = new XmlDocument();
-
- // Load the passed XML file using its name.
- doc.Load(new XmlTextReader(FileName));
-
- // Create a SignedXml object.
- SignedXml signedXml = new SignedXml(doc);
-
- // Add the key to the SignedXml document.
- signedXml.SigningKey = Key;
-
- // Create a reference to be signed.
- Reference reference = new Reference();
- reference.Uri = "";
-
- // Add an enveloped transformation to the reference.
- XmlDsigEnvelopedSignatureTransform env = new XmlDsigEnvelopedSignatureTransform();
- reference.AddTransform(env);
-
- // Add the reference to the SignedXml object.
- signedXml.AddReference(reference);
-
- // Compute the signature.
- signedXml.ComputeSignature();
-
- // Get the XML representation of the signature and save
- // it to an XmlElement object.
- XmlElement xmlDigitalSignature = signedXml.GetXml();
-
- // Append the element to the XML document.
- doc.DocumentElement.AppendChild(doc.ImportNode(xmlDigitalSignature, true));
-
- if (doc.FirstChild is XmlDeclaration)
- {
- doc.RemoveChild(doc.FirstChild);
- }
-
- // Save the signed XML document to a file specified
- // using the passed string.
- XmlTextWriter xmltw = new XmlTextWriter(SignedFileName, new UTF8Encoding(false));
- doc.WriteTo(xmltw);
- xmltw.Close();
- }
-
- // Verify the signature of an XML file against an asymetric
- // algorithm and return the result.
- public static Boolean VerifyXmlFile(String Name, RSA Key)
- {
- // Create a new XML document.
- XmlDocument xmlDocument = new XmlDocument();
-
- // Load the passed XML file into the document.
- xmlDocument.Load(Name);
-
- // Create a new SignedXml object and pass it
- // the XML document class.
- SignedXml signedXml = new SignedXml(xmlDocument);
-
- // Find the "Signature" node and create a new
- // XmlNodeList object.
- XmlNodeList nodeList = xmlDocument.GetElementsByTagName("Signature");
-
- // Load the signature node.
- signedXml.LoadXml((XmlElement)nodeList[0]);
-
- // Check the signature and return the result.
- return signedXml.CheckSignature(Key);
- }
-
-
- // Create example data to sign.
- public static void CreateSomeXml(string FileName)
- {
- // Create a new XmlDocument object.
- XmlDocument document = new XmlDocument();
-
- // Create a new XmlNode object.
- XmlNode node = document.CreateNode(XmlNodeType.Element, "", "MyElement", "samples");
-
- // Add some text to the node.
- node.InnerText = "Example text to be signed.";
-
- // Append the node to the document.
- document.AppendChild(node);
-
- // Save the XML document to the file name specified.
- XmlTextWriter xmltw = new XmlTextWriter(FileName, new UTF8Encoding(false));
- document.WriteTo(xmltw);
- xmltw.Close();
- }
-}
diff --git a/test/validators/XmlCryptoUtilities/XmlCryptoUtilities/utilities.cs b/test/validators/XmlCryptoUtilities/XmlCryptoUtilities/utilities.cs
deleted file mode 100644
index 5ed16f80..00000000
--- a/test/validators/XmlCryptoUtilities/XmlCryptoUtilities/utilities.cs
+++ /dev/null
@@ -1,75 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Security.Cryptography.Xml;
-using System.Security.Cryptography;
-using System.Security.Cryptography.X509Certificates;
-using System.Xml;
-using System.IO;
-
-namespace ConsoleApplication31
-{
- /*
- class Program
- {
- static void Main(string[] args)
- {
- GetCanonization();
- //GetSignature();
-
- }
-
- static void GetSignature()
- {
- XmlDocument doc = new XmlDocument();
- //doc.LoadXml("");
- doc.LoadXml("");
- SignedXml signedXml = new SignedXml(doc);
-
- var c = new X509Certificate2(
- File.ReadAllBytes(@"C:\Program Files\Microsoft WSE\v2.0\Samples\Sample Test Certificates\Client Private.pfx"), "wse2qs");
-
- signedXml.SigningKey = c.PrivateKey;
- signedXml.Signature.SignedInfo.CanonicalizationMethod = "http://www.w3.org/2001/10/xml-exc-c14n#";
-
- Reference ref0 = new Reference();
- ref0.Uri = "#_0";
- Reference ref1 = new Reference();
- ref1.Uri = "#_1";
- Reference ref2 = new Reference();
- ref2.Uri = "#_2";
-
- var t = new XmlDsigExcC14NTransform();
- ref0.AddTransform(t);
- ref1.AddTransform(t);
- ref2.AddTransform(t);
-
- signedXml.AddReference(ref0);
- signedXml.AddReference(ref1);
- signedXml.AddReference(ref2);
-
- signedXml.ComputeSignature();
- var xmlDigitalSignature = signedXml.GetXml();
- var s = xmlDigitalSignature.OuterXml;
- }
-
- static void GetCanonization()
- {
- var c = new XmlDsigExcC14NTransform(true, "");
- var doc = new XmlDocument();
- doc.PreserveWhitespace = true;
- doc.LoadXml("");
- var node = doc.SelectSingleNode("//*[local-name(.)='x']");
- var nodes = node.SelectNodes(".|.//*|.//text()|.//@*");
- c.LoadInput(nodes);
-
- var h = new SHA1CryptoServiceProvider();
- var b = c.GetDigestedOutput(h);
- var b64 = Convert.ToBase64String(b);
-
- var res = c.GetOutput() as MemoryStream;
- string s2 = System.Text.Encoding.UTF8.GetString(res.ToArray());
- }
- }*/
-}