New tests.
[mono.git] / mcs / class / corlib / Mono.Security / StrongName.cs
index a1a9b6660ddf89f89558e4c253c170ec34555bd4..2905a03c125c4a9302b0249f588504d2d4bae5cd 100644 (file)
@@ -160,7 +160,7 @@ namespace Mono.Security {
                        get {
                                if (rsa == null)
                                        return false;
-#if INSIDE_CORLIB
+#if INSIDE_CORLIB && !MOONLIGHT
                                // the easy way
                                if (RSA is RSACryptoServiceProvider) {
                                        // available as internal for corlib
@@ -430,11 +430,17 @@ namespace Mono.Security {
 
                public bool Verify (string fileName) 
                {
-                       StrongNameSignature sn;
+                       bool result = false;
                        using (FileStream fs = File.OpenRead (fileName)) {
-                               sn = StrongHash (fs, StrongNameOptions.Signature);
+                               result = Verify (fs);
                                fs.Close ();
                        }
+                       return result;
+               }
+
+               public bool Verify (Stream stream)
+               {
+                       StrongNameSignature sn = StrongHash (stream, StrongNameOptions.Signature);
                        if (sn.Hash == null) {
                                return false;
                        }
@@ -461,8 +467,12 @@ namespace Mono.Security {
                        if (!initialized) {
                                lock (lockObject) {
                                        if (!initialized) {
+#if NET_2_1
+                                               // Moonlight cannot depend on machine.config
+#else
                                                string config = Environment.GetMachineConfigPath ();
                                                StrongNameManager.LoadConfig (config);
+#endif
                                                initialized = true;
                                        }
                                }