diff --git a/CSharpTranslator/resources/cs2jsign_priv.xml b/CSharpTranslator/resources/cs2jsign_priv.xml deleted file mode 100644 index 33ebc4a..0000000 --- a/CSharpTranslator/resources/cs2jsign_priv.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - iTXgwMVVIk25/pstsBVNNsONs5Q4haeikef5YcRBuTh6slndGs5cj7h0LSHRqPNesp3EwVmwJYY11bDkutN1+rzs9EH3X4vJI6SKgKEHDi5ZV1kfZ8eA3xos8TKNvE4WK33+0ZmZJYkL0sknFyEOIGVek/OiAlsriNZ7NmerWuU= - EQ== -

teD3MpiNYNTdY3gFV8kT9F8MTEfATJYvsxLtQ24I/X0Q4rwzq07u41/gO5ehQEb6F4OQlgCL707KirEeivNxHQ==

- wSDCnfzvZjtus/dELAEbcoXr6xwNDOhv4kQWcvw0082rnrdCUP0P0eGwf2HYmvfD5Y8Jul6+7c2QoQTG8f3uaQ== - SuQpjU3f3JPisHy25+likczI1B2LatRt/nE0hS1O/vdDMC9gkdU1MHLFvi9gg+D9kTYsegA5nsYXKgyyOTcQdQ== - FriPXeGFk46FfpWPjLTWDXkq0F2nLrHvC4+KK6UzZDZQbQaARcNrRd5Q/+1kxu/47dSXu5KtDOsB9NNisw7QwQ== - gAjT95yK4HjU9TV1X3j8UZqfYs0Cl7kTcWLvBTNJrWE8CAYtN6U16tcuuTYtcRDxD/tP+DWb5w2F98C++6qzAg== - GDavMRPDusJsHd8mLiHgcxNzW+z66mjgdBngtuZl84JwAVsnBLsBRon2YlFDHdCYPaNe9PG1rETcUuL7MAcy78ELZKqYzao+vKBuNucKveb2ayQSDDGH7RdxC8qc2hYFyEqvLkjvf1KNGrc1Od8kmOU6lXcp5CVN+QAEs+0v4RE= -
\ No newline at end of file diff --git a/CSharpTranslator/resources/cs2jsign_pub.xml b/CSharpTranslator/resources/cs2jsign_pub.xml deleted file mode 100644 index a614362..0000000 --- a/CSharpTranslator/resources/cs2jsign_pub.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - iTXgwMVVIk25/pstsBVNNsONs5Q4haeikef5YcRBuTh6slndGs5cj7h0LSHRqPNesp3EwVmwJYY11bDkutN1+rzs9EH3X4vJI6SKgKEHDi5ZV1kfZ8eA3xos8TKNvE4WK33+0ZmZJYkL0sknFyEOIGVek/OiAlsriNZ7NmerWuU= - EQ== - \ No newline at end of file diff --git a/CSharpTranslator/src/CS2JKeyGenerator/AssemblyInfo.cs b/CSharpTranslator/src/CS2JKeyGenerator/AssemblyInfo.cs deleted file mode 100644 index c6fdcec..0000000 --- a/CSharpTranslator/src/CS2JKeyGenerator/AssemblyInfo.cs +++ /dev/null @@ -1,27 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; - -// Information about this assembly is defined by the following attributes. -// Change them to the values specific to your project. - -[assembly: AssemblyTitle("CS2JKeyGenerator")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("")] -[assembly: AssemblyCopyright("")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}". -// The form "{Major}.{Minor}.*" will automatically update the build and revision, -// and "{Major}.{Minor}.{Build}.*" will update just the revision. - -[assembly: AssemblyVersion("1.0.*")] - -// The following attributes are used to specify the signing key for the assembly, -// if desired. See the Mono documentation for more information about signing. - -//[assembly: AssemblyDelaySign(false)] -//[assembly: AssemblyKeyFile("")] - diff --git a/CSharpTranslator/src/CS2JKeyGenerator/CS2JKeyGenerator.csproj b/CSharpTranslator/src/CS2JKeyGenerator/CS2JKeyGenerator.csproj deleted file mode 100644 index 5633d15..0000000 --- a/CSharpTranslator/src/CS2JKeyGenerator/CS2JKeyGenerator.csproj +++ /dev/null @@ -1,48 +0,0 @@ - - - - Debug - AnyCPU - 10.0.0 - 2.0 - {F294E768-56C3-438A-A3E5-8FA39825262E} - Exe - CS2JKeyGenerator - CS2JKeyGenerator - v3.5 - Twiglet.CS2J.Utility.KeyGenerator - - - true - full - false - bin\Debug - DEBUG - prompt - 4 - true - - - none - false - bin\Release - prompt - 4 - true - - - - - - - - - - - - - {E6ACBB37-AF38-45E1-B399-0CEE63809A15} - NDesk.Options - - - \ No newline at end of file diff --git a/CSharpTranslator/src/CS2JKeyGenerator/Main.cs b/CSharpTranslator/src/CS2JKeyGenerator/Main.cs deleted file mode 100644 index 8a1c36d..0000000 --- a/CSharpTranslator/src/CS2JKeyGenerator/Main.cs +++ /dev/null @@ -1,102 +0,0 @@ -/* - Copyright 2010,2011 Kevin Glynn (kevin.glynn@twigletsoftware.com) -*/ - -using System; -using System.Reflection; -using System.IO; -using System.Text; -using NDesk.Options; -using System.Collections.Generic; -using System.Security.Cryptography; -using System.Xml; - - -namespace Twiglet.CS2J.Utility -{ - public class KeyGenerator - { - private const string CS2JKEYGEN_VERSION = "pre-release"; - - private static void printUsageAndExit() - { - Console.Out.WriteLine("Usage: " + Path.GetFileNameWithoutExtension(System.Environment.GetCommandLineArgs()[0]) + " "); - Console.Out.WriteLine(" [-version] (show version information)"); - Console.Out.WriteLine(" [-help|h|?] (this usage message)"); - Console.Out.WriteLine(" [-v] (be [somewhat more] verbose, repeat for more verbosity)"); - Console.Out.WriteLine(" [-keypath ] (directory to place the key files)"); - Console.Out.WriteLine(" [-keyname ] (name of this key pair, used to name the key files)"); - Environment.Exit(0); - } - - private static void printVersion() - { - Console.Out.WriteLine(Path.GetFileNameWithoutExtension(System.Environment.GetCommandLineArgs()[0])); - Console.WriteLine("Version: {0}", CS2JKEYGEN_VERSION); - } - - public static void Main(string[] args) - { - int Verbose = 0; - RSACryptoServiceProvider RsaKey = null; - string KeyPath = Directory.GetCurrentDirectory(); - string KeyName = "rsakey"; - OptionSet p = new OptionSet() - .Add("v", v => Verbose++) - .Add("version", v => printVersion()) - .Add("help|h|?", v => printUsageAndExit()) - .Add("keypath=", dir => KeyPath = Path.GetFullPath(dir)) - .Add("keyname=", name => KeyName = name) - ; - - p.Parse(args); - - try - { - // Create a new CspParameters object to specify - // a key container. - CspParameters cspParams = new CspParameters(); - cspParams.KeyContainerName = "XML_DSIG_RSA_KEY"; - - // Create a new RSA signing key and save it in the container. - RsaKey = new RSACryptoServiceProvider(cspParams); - - // We don't want to store the key in the csp, and also we don't want to get the same key - // each time. - RsaKey.PersistKeyInCsp = false; - - if (!Directory.Exists(KeyPath)) - { - Directory.CreateDirectory(KeyPath); - } - - XmlWriterSettings set = new XmlWriterSettings(); - set.Indent = true; - set.Encoding = Encoding.UTF8; - - // Write public key info - XmlWriter xw = XmlWriter.Create(Path.Combine(KeyPath, KeyName + "_pub.xml"), set); - - XmlReader reader = XmlReader.Create(new StringReader(RsaKey.ToXmlString(false))); - - xw.WriteNode(reader, true); - xw.Close(); - - // Write public/private key info - xw = XmlWriter.Create(Path.Combine(KeyPath, KeyName + "_priv.xml"), set); - - reader = XmlReader.Create(new StringReader(RsaKey.ToXmlString(true))); - - xw.WriteNode(reader, true); - xw.Close(); - - - } - catch (Exception e) - { - Console.WriteLine(e.Message); - } - } - } -} - diff --git a/CSharpTranslator/src/CS2JTemplateSigner/CS2JTemplateSigner.csproj b/CSharpTranslator/src/CS2JTemplateSigner/CS2JTemplateSigner.csproj deleted file mode 100755 index 68b346a..0000000 --- a/CSharpTranslator/src/CS2JTemplateSigner/CS2JTemplateSigner.csproj +++ /dev/null @@ -1,66 +0,0 @@ - - - - Debug - x86 - 8.0.30703 - 2.0 - {DF234BD4-A292-4C92-AC8E-F97D3E821079} - Exe - Properties - CS2JTemplateSigner - CS2JTemplateSigner - v3.5 - 512 - Twiglet.CS2J.Utility.TemplateSigner - - - x86 - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - -keyfile /tmp/fred/kg_priv.xml /Users/keving/gitrepos/cs2j/CS2JLibrary/NetFramework/System/Collections/Generic/KeyValuePair\'2.xml - false - - - x86 - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - - - - - - - - - - - - - - - {E6ACBB37-AF38-45E1-B399-0CEE63809A15} - NDesk.Options - - - - - \ No newline at end of file diff --git a/CSharpTranslator/src/CS2JTemplateSigner/Main.cs b/CSharpTranslator/src/CS2JTemplateSigner/Main.cs deleted file mode 100755 index daf25b5..0000000 --- a/CSharpTranslator/src/CS2JTemplateSigner/Main.cs +++ /dev/null @@ -1,227 +0,0 @@ -/* - Copyright 2010,2011 Kevin Glynn (kevin.glynn@twigletsoftware.com) -*/ - -using System; -using System.Reflection; -using System.IO; -using System.Xml.Serialization; -using System.Xml; -using System.Text; -using NDesk.Options; -using System.Collections.Generic; -using System.Security.Cryptography; -using System.Security.Cryptography.Xml; - -namespace Twiglet.CS2J.Utility -{ - public class TemplateSigner - { - private const string CS2JSIGNER_VERSION = "pre-release"; - private int Verbose { get; set; } - public delegate void FileProcessor(string fName); - private List XmlDirs { get; set; } - private List ExcludeXmlDirs { get; set; } - private String KeyFile = null; - RSACryptoServiceProvider RsaKey { get; set; } - - public TemplateSigner() - { - Verbose = 0; - XmlDirs = new List(); - ExcludeXmlDirs = new List(); - RsaKey = null; - } - - private static void printUsageAndExit() - { - Console.Out.WriteLine("Usage: " + Path.GetFileNameWithoutExtension(System.Environment.GetCommandLineArgs()[0]) + " "); - Console.Out.WriteLine(" [-version] (show version information)"); - Console.Out.WriteLine(" [-help|h|?] (this usage message)"); - Console.Out.WriteLine(" [-v] (be [somewhat more] verbose, repeat for more verbosity)"); - Console.Out.WriteLine(" [-privkeyfile ] (can be multiple directories, separated by semi-colons)"); - Console.Out.WriteLine(" [-exxmlpath ] (can be multiple directories/files, separated by semi-colons)"); - Console.Out.WriteLine(" [] (can be multiple directories, separated by semi-colons)"); - Environment.Exit(0); - } - - private static void printVersion() - { - Console.Out.WriteLine(Path.GetFileNameWithoutExtension(System.Environment.GetCommandLineArgs()[0])); - Console.WriteLine("Version: {0}", CS2JSIGNER_VERSION); - } - - private static void addDirectories(IList strs, string rawStr) - { - string[] argDirs = rawStr.Split(';'); - for (int i = 0; i < argDirs.Length; i++) - strs.Add(Path.GetFullPath(argDirs[i])); - } - - - public static void Main(string[] args) - { - - TemplateSigner templateSigner = new TemplateSigner(); - List xmlDirs = new List(); - List excludeXmlDirs = new List(); - OptionSet p = new OptionSet() - .Add("v", v => templateSigner.Verbose++) - .Add("version", v => printVersion()) - .Add("help|h|?", v => printUsageAndExit()) - .Add("keyfile=", fname => templateSigner.KeyFile = Path.GetFullPath(fname)) - .Add("xmlpath=", dirs => addDirectories(xmlDirs, dirs)) - .Add("exxmlpath=", dirs => addDirectories(excludeXmlDirs, dirs)) - ; - List leftovers = p.Parse(args); - if (leftovers != null) - { - foreach (string d in leftovers) - { - addDirectories(xmlDirs, d); - } - } - templateSigner.XmlDirs = xmlDirs; - templateSigner.ExcludeXmlDirs = excludeXmlDirs; - if (!File.Exists(templateSigner.KeyFile)) { - Console.Out.WriteLine("Error: RSA key at '" + templateSigner.KeyFile + "' not found, aborting."); - Environment.Exit(1); - } - templateSigner.SignXmlFiles(); - } - - public void SignXmlFiles() { - try - { - XmlReader reader = XmlReader.Create(KeyFile); - reader.MoveToContent(); - - // Create a new CspParameters object to specify - // a key container. - CspParameters cspParams = new CspParameters(); - cspParams.KeyContainerName = "XML_DSIG_RSA_KEY"; - - // Initialise from . - RsaKey = new RSACryptoServiceProvider(cspParams); - RsaKey.PersistKeyInCsp = false; - RsaKey.FromXmlString(reader.ReadOuterXml()); - - // Load .Net templates - if (XmlDirs != null) - { - foreach (string r in XmlDirs) - doFile(r, ".xml", SignNetTranslation, ExcludeXmlDirs); - } - - } - catch (Exception e) - { - Console.WriteLine(e.Message); - } - } - - private void SignNetTranslation(string filePath) - { - // Create a new XML document. - XmlDocument xmlDoc = new XmlDocument(); - - // Load an XML file into the XmlDocument object. - xmlDoc.PreserveWhitespace = true; - xmlDoc.Load(filePath); - - // Sign the XML document. - SignXml(xmlDoc, RsaKey); - - Console.WriteLine("XML file signed."); - - // Save the document. - xmlDoc.Save(filePath); - - } - - - // Sign an XML file. - // This document cannot be verified unless the verifying - // code has the key with which it was signed. - private void SignXml(XmlDocument xmlDoc, RSA Key) - { - // Check arguments. - if (xmlDoc == null) - throw new ArgumentException("xmlDoc"); - if (Key == null) - throw new ArgumentException("Key"); - - // Add the namespace. - XmlNamespaceManager nsmgr = new XmlNamespaceManager(xmlDoc.NameTable); - nsmgr.AddNamespace("ss", "http://www.w3.org/2000/09/xmldsig#"); - - // Remove any existing signature(s) - XmlNode root = xmlDoc.DocumentElement; - XmlNodeList nodeList = root.SelectNodes("/*/ss:Signature", nsmgr); - for (int i = nodeList.Count - 1; i >= 0; i--) - { - nodeList[i].ParentNode.RemoveChild(nodeList[i]); - } - // Create a SignedXml object. - SignedXml signedXml = new SignedXml(xmlDoc); - - - // 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. - xmlDoc.DocumentElement.AppendChild(xmlDoc.ImportNode(xmlDigitalSignature, true)); - - } - - // Call processFile on all files below f that have the given extension - private void doFile(string root, string ext, FileProcessor processFile, IList excludes) - { - string canonicalPath = Path.GetFullPath(root); - // If this is a directory, walk each file/dir in that directory - if (!excludes.Contains(canonicalPath.ToLower())) - { - if (Directory.Exists(canonicalPath)) - { - string[] files = Directory.GetFileSystemEntries(canonicalPath); - for (int i = 0; i < files.Length; i++) - doFile(Path.Combine(canonicalPath, files[i]), ext, processFile, excludes); - } - else if ((Path.GetFileName(canonicalPath).Length > ext.Length) && canonicalPath.Substring(canonicalPath.Length - ext.Length).Equals(ext)) - { - if (Verbose >= 2) Console.WriteLine(" " + canonicalPath); - try - { - processFile(canonicalPath); - } - catch (Exception e) - { - Console.Error.WriteLine("\nCannot process file: " + canonicalPath); - Console.Error.WriteLine("exception: " + e); - } - } - } - } - - } -} - diff --git a/CSharpTranslator/src/CS2JTemplateSigner/Properties/AssemblyInfo.cs b/CSharpTranslator/src/CS2JTemplateSigner/Properties/AssemblyInfo.cs deleted file mode 100755 index d9781d6..0000000 --- a/CSharpTranslator/src/CS2JTemplateSigner/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("CS2JTemplateSigner")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("CS2JTemplateSigner")] -[assembly: AssemblyCopyright("Copyright © 2011")] -[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("26a927a7-f3de-4603-9719-a2aebb6c7295")] - -// 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")]