2005-09-25 Sebastien Pouliot <sebastien@ximian.com>
authorSebastien Pouliot <sebastien@ximian.com>
Sun, 25 Sep 2005 15:10:07 +0000 (15:10 -0000)
committerSebastien Pouliot <sebastien@ximian.com>
Sun, 25 Sep 2005 15:10:07 +0000 (15:10 -0000)
* X509Certificate.cs: Fix date/time reporting for NET_2_0 profile (bug
fixed in 2.0).

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

mcs/class/corlib/System.Security.Cryptography.X509Certificates/ChangeLog
mcs/class/corlib/System.Security.Cryptography.X509Certificates/X509Certificate.cs

index beb9a2e517cf17e8afe64e6f201daa9e0a81f9be..3f9b81ad5acb3ac4f50291526058a9da722ed02d 100644 (file)
@@ -1,3 +1,8 @@
+2005-09-25  Sebastien Pouliot  <sebastien@ximian.com>
+
+       * X509Certificate.cs: Fix date/time reporting for NET_2_0 profile (bug
+       fixed in 2.0).
+
 2005-04-27  Sebastien Pouliot  <sebastien@ximian.com>
 
        * X509Certificate.cs: Updated features for 2.0.
index b61fd6e0da365263ca60a05f143955cc57b35a2a..25cd921d1cff02de90136d34fa802887734f47b6 100644 (file)
@@ -98,7 +98,7 @@ namespace System.Security.Cryptography.X509Certificates {
                public static X509Certificate CreateFromCertFile (string filename) 
                {
                        byte[] data = null;
-                       using (FileStream fs = new FileStream (filename, FileMode.Open)) {
+                       using (FileStream fs = File.OpenRead (filename)) {
                                data = new byte [fs.Length];
                                fs.Read (data, 0, data.Length);
                                fs.Close ();
@@ -286,25 +286,31 @@ namespace System.Security.Cryptography.X509Certificates {
                }
        
                // strangly there are no DateTime returning function
-               // LAMESPEC: Microsoft returns the local time from Pacific Time (GMT-8)
-               // BUG: This will not be corrected in Framework 1.1 and also affect WSE 1.0
                public virtual string GetEffectiveDateString ()
                {
                        if (hideDates)
                                return null;
-                       DateTime dt = x509.ValidFrom.ToUniversalTime().AddHours (-8);
-                       return dt.ToString (); //"yyyy-MM-dd HH:mm:ss");
+#if NET_2_0
+                       return x509.ValidFrom.ToString ();
+#else
+                       // LAMESPEC: Microsoft returns the local time from Pacific Time (GMT-8)
+                       // BUG: This will not be corrected in Framework 1.1 and also affect WSE 1.0
+                       return x509.ValidFrom.ToUniversalTime ().AddHours (-8).ToString ();
+#endif
                }
        
                // strangly there are no DateTime returning function
-               // LAMESPEC: Microsoft returns the local time from Pacific Time (GMT-8)
-               // BUG: This will not be corrected in Framework 1.1 and also affect WSE 1.0
                public virtual string GetExpirationDateString () 
                {
                        if (hideDates)
                                return null;
-                       DateTime dt = x509.ValidUntil.ToUniversalTime().AddHours (-8);
-                       return dt.ToString (); //"yyyy-MM-dd HH:mm:ss");
+#if NET_2_0
+                       return x509.ValidUntil.ToString ();
+#else
+                       // LAMESPEC: Microsoft returns the local time from Pacific Time (GMT-8)
+                       // BUG: This will not be corrected in Framework 1.1 and also affect WSE 1.0
+                       return x509.ValidUntil.ToUniversalTime ().AddHours (-8).ToString ();
+#endif
                }
        
                // well maybe someday there'll be support for PGP or SPKI ?