#else
public
#endif
-#if NET_2_0
static class ASN1Convert {
-#else
- sealed class ASN1Convert {
-
- private ASN1Convert ()
- {
- }
-#endif
// RFC3280, section 4.2.1.5
// CAs conforming to this profile MUST always encode certificate
// validity dates through the year 2049 as UTCTime; certificate validity
// to support both UTCTime and GeneralizedTime (and not so common format)
string mask = null;
int year;
- bool utc = true;
switch (t.Length) {
case 11:
// illegal format, still it's supported for compatibility
t = String.Format ("{0}{1}{2}{3}{4}:{5}{6}", century, t.Substring (0, 12), sign,
t[13], t[14], t[15], t[16]);
mask = "yyyyMMddHHmmsszzz";
- utc = false;
break;
}
-#if NET_2_0
- return DateTime.ParseExact (t, mask, null, DateTimeStyles.AdjustToUniversal);
-#else
- DateTime result = DateTime.ParseExact (t, mask, null);
- if (utc)
- return result;
- return result.ToUniversalTime ();
-#endif
+ return DateTime.ParseExact (t, mask, CultureInfo.InvariantCulture, DateTimeStyles.AdjustToUniversal);
}
}
}