Author: spouliot
Date: 2007-01-05 11:38:54 -0500 (Fri, 05 Jan 2007)
New Revision: 70537

Modified:
   trunk/mcs/class/Mono.Security/Mono.Security/ASN1Convert.cs
   trunk/mcs/class/Mono.Security/Mono.Security/ChangeLog
Log:
2007-01-05  Sebastien Pouliot  <[EMAIL PROTECTED]>

        * ASN1Convert.cs: Added comment to FromDateTime to specify that, under
        1.x, the DateTime must be a local (not UTC) date time. Fixed ToDateTime
        to return a DateTimeKind.Utc DateTime under 2.0.



Modified: trunk/mcs/class/Mono.Security/Mono.Security/ASN1Convert.cs
===================================================================
--- trunk/mcs/class/Mono.Security/Mono.Security/ASN1Convert.cs  2007-01-05 
16:20:04 UTC (rev 70536)
+++ trunk/mcs/class/Mono.Security/Mono.Security/ASN1Convert.cs  2007-01-05 
16:38:54 UTC (rev 70537)
@@ -7,7 +7,7 @@
 //
 // (C) 2003 Motus Technologies Inc. (http://www.motus.com)
 // (C) 2004 IT+ A/S (http://www.itplus.dk)
-// Copyright (C) 2004-2005 Novell, Inc (http://www.novell.com)
+// Copyright (C) 2004-2007 Novell, Inc (http://www.novell.com)
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the
@@ -59,6 +59,9 @@
                // CAs conforming to this profile MUST always encode certificate
                // validity dates through the year 2049 as UTCTime; certificate 
validity
                // dates in 2050 or later MUST be encoded as GeneralizedTime.
+
+               // Under 1.x this API requires a Local datetime to be provided
+               // Under 2.0 it will also accept a Utc datetime
                static public ASN1 FromDateTime (DateTime dt) 
                {
                        if (dt.Year < 2050) {
@@ -199,7 +202,11 @@
                                        mask = "yyyyMMddHHmmssZ"; // 
GeneralizedTime
                                        break;
                        }
+#if NET_2_0
+                       return DateTime.ParseExact (t, mask, null, 
DateTimeStyles.AdjustToUniversal);
+#else
                        return DateTime.ParseExact (t, mask, null);
+#endif
                }
        }
 }

Modified: trunk/mcs/class/Mono.Security/Mono.Security/ChangeLog
===================================================================
--- trunk/mcs/class/Mono.Security/Mono.Security/ChangeLog       2007-01-05 
16:20:04 UTC (rev 70536)
+++ trunk/mcs/class/Mono.Security/Mono.Security/ChangeLog       2007-01-05 
16:38:54 UTC (rev 70537)
@@ -1,3 +1,9 @@
+2007-01-05  Sebastien Pouliot  <[EMAIL PROTECTED]>
+
+       * ASN1Convert.cs: Added comment to FromDateTime to specify that, under
+       1.x, the DateTime must be a local (not UTC) date time. Fixed ToDateTime
+       to return a DateTimeKind.Utc DateTime under 2.0.
+
 2006-08-17  Sebastien Pouliot  <[EMAIL PROTECTED]>
 
        * StrongName.cs: Fix the (very unlikely) case where an MD5 public key

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to