argh
[mono.git] / mcs / tools / security / StrongNameManager.cs
old mode 100755 (executable)
new mode 100644 (file)
index 7f32478..e47b6b8
@@ -9,6 +9,7 @@
 
 using System;
 using System.Collections;
+using System.Globalization;
 using System.IO;
 using System.Reflection;
 using System.Security;
@@ -92,15 +93,18 @@ namespace Mono.Security {
                                        sp.LoadXml (xml);
                                }
                                SecurityElement root = sp.ToXml ();
-                               if ((root != null) && (root.Tag == "strongNames")) {
-                                       SecurityElement mapping  = root.SearchForChildByTag ("pubTokenMapping");
-                                       if ((mapping != null) && (mapping.Children.Count > 0)) {
-                                               LoadMapping (mapping);
-                                       }
-
-                                       SecurityElement settings = root.SearchForChildByTag ("verificationSettings");
-                                       if ((settings != null) && (settings.Children.Count > 0)) {
-                                               LoadVerificationSettings (settings);
+                               if ((root != null) && (root.Tag == "configuration")) {
+                                       SecurityElement strongnames  = root.SearchForChildByTag ("strongNames");
+                                       if ((strongnames != null) && (strongnames.Children.Count > 0)) {
+                                               SecurityElement mapping  = strongnames.SearchForChildByTag ("pubTokenMapping");
+                                               if ((mapping != null) && (mapping.Children.Count > 0)) {
+                                                       LoadMapping (mapping);
+                                               }
+
+                                               SecurityElement settings = strongnames.SearchForChildByTag ("verificationSettings");
+                                               if ((settings != null) && (settings.Children.Count > 0)) {
+                                                       LoadVerificationSettings (settings);
+                                               }
                                        }
                                }
                        }
@@ -120,6 +124,7 @@ namespace Mono.Security {
                                        string token = item.Attribute ("Token");
                                        if ((token == null) || (token.Length != 16))
                                                continue; // invalid entry
+                                       token = token.ToUpper (CultureInfo.InvariantCulture);
 
                                        string publicKey = item.Attribute ("PublicKey");
                                        if (publicKey == null)
@@ -151,6 +156,7 @@ namespace Mono.Security {
                                        string token = item.Attribute ("Token");
                                        if (token == null)
                                                continue;       // bad entry
+                                       token = token.ToUpper (CultureInfo.InvariantCulture);
 
                                        string assembly = item.Attribute ("Assembly");
                                        if (assembly == null)
@@ -242,6 +248,11 @@ namespace Mono.Security {
                        StringBuilder sb = new StringBuilder ();
                        sb.Append ("Public Key Token\tAssemblies\t\tUsers");
                        sb.Append (Environment.NewLine);
+                       if (tokens == null) {
+                               sb.Append ("none");
+                               return sb.ToString ();
+                       }
+
                        foreach (DictionaryEntry token in tokens) {
                                sb.Append ((string)token.Key);
                                Element t = (Element) token.Value;