2006-05-09 Sebastien Pouliot <sebastien@ximian.com>
authorSebastien Pouliot <sebastien@ximian.com>
Tue, 9 May 2006 13:25:59 +0000 (13:25 -0000)
committerSebastien Pouliot <sebastien@ximian.com>
Tue, 9 May 2006 13:25:59 +0000 (13:25 -0000)
* sn.cs: Don't throw an exception on invalid assemblies (e.g.
netmodules). Fixed some typos.

svn path=/trunk/mcs/; revision=60443

mcs/tools/security/ChangeLog
mcs/tools/security/sn.cs

index 66513e7af52a82258bc41e59f72df844d13b8d4a..647419c0ceb99bee40489e0ae1f555c5d40e7bd9 100644 (file)
@@ -1,3 +1,8 @@
+2006-05-09  Sebastien Pouliot  <sebastien@ximian.com>
+
+       * sn.cs: Don't throw an exception on invalid assemblies (e.g. 
+       netmodules). Fixed some typos.
+
 2006-03-15  Hector E. Gomez Morales  <hectorgm@ciencias.unam.mx>
 
        * secutil.cs: Print an error when asked to display the strong name 
index 7c4ccbca7ca12ed1100dc52747ea159e74c59579..b1e1cd987cebf37cf592b24b76f96d9a18c5187a 100644 (file)
@@ -5,7 +5,7 @@
 //     Sebastien Pouliot  <sebastien@ximian.com>
 //
 // (C) 2003 Motus Technologies Inc. (http://www.motus.com)
-// Copyright (C) 2004-2005 Novell, Inc (http://www.novell.com)
+// Copyright (C) 2004-2006 Novell, Inc (http://www.novell.com)
 //
 
 using System;
@@ -116,7 +116,7 @@ namespace Mono.Tools {
                        }
                        return sb.ToString ();
                }
-
+#if false
                // is assembly signed (or delayed signed) ?
                static bool IsStrongNamed (Assembly assembly) 
                {
@@ -132,12 +132,17 @@ namespace Mono.Tools {
                        }
                        return false;
                }
-
+#endif
                static bool ReSign (string assemblyName, RSA key) 
                {
                        // this doesn't load the assembly (well it unloads it ;)
                        // http://weblogs.asp.net/nunitaddin/posts/9991.aspx
-                       AssemblyName an = AssemblyName.GetAssemblyName (assemblyName);
+                       AssemblyName an = null;
+                       try {
+                               an = AssemblyName.GetAssemblyName (assemblyName);
+                       }
+                       catch {
+                       }
                        if (an == null) {
                                Console.WriteLine ("Unable to load assembly: {0}", assemblyName);
                                return false;
@@ -172,7 +177,12 @@ namespace Mono.Tools {
                {
                        // this doesn't load the assembly (well it unloads it ;)
                        // http://weblogs.asp.net/nunitaddin/posts/9991.aspx
-                       AssemblyName an = AssemblyName.GetAssemblyName (assemblyName);
+                       AssemblyName an = null;
+                       try {
+                               an = AssemblyName.GetAssemblyName (assemblyName);
+                       }
+                       catch {
+                       }
                        if (an == null) {
                                Console.WriteLine ("Unable to load assembly: {0}", assemblyName);
                                return 2;
@@ -235,6 +245,7 @@ namespace Mono.Tools {
                                        Console.WriteLine (" -Vr assembly [userlist]{0}\tExempt the specified assembly from verification for the user list", Environment.NewLine);
                                        Console.WriteLine (" -Vu assembly{0}\tRemove exemption entry for the specified assembly", Environment.NewLine);
                                        Console.WriteLine (" -Vx{0}\tRemove all exemptions entries", Environment.NewLine);
+                                       Console.WriteLine ("{0}<1> Currently not implemented in the tool", Environment.NewLine);
                                        break;
                                case "csp":
                                        Console.WriteLine ("CSP related options");
@@ -271,7 +282,6 @@ namespace Mono.Tools {
                                        Console.WriteLine (" -? | -h sn     \tStrongName signing options");
                                        break;
                        }
-                       Console.WriteLine ("{0}<1> Currently not implemented in the tool", Environment.NewLine);
                }
 
                [STAThread]
@@ -363,7 +373,7 @@ namespace Mono.Tools {
                                        byte[] infileD = ReadFromFile (args [i++]);
                                        WriteCSVToFile (args [i], infileD, "D");
                                        if (!quiet)
-                                               Console.WriteLine ("Output CVS file is {0} (decimal format)", args [i]);
+                                               Console.WriteLine ("Output CSV file is {0} (decimal format)", args [i]);
                                        break;
                                case "-oh":
                                        byte[] infileX2 = ReadFromFile (args [i++]);