private static DateTime AsnTimeToDateTime(IntPtr ptr) { string str; using (BIO bio = BIO.MemoryBuffer()) { Native.ExpectSuccess(Native.ASN1_UTCTIME_print(bio.Handle, ptr)); str = bio.ReadString(); } string[] fmts = { "MMM d HH:mm:ss yyyy G\\MT", "MMM dd HH:mm:ss yyyy G\\MT" }; return(DateTime.ParseExact(str, fmts, new DateTimeFormatInfo(), DateTimeStyles.AssumeUniversal | DateTimeStyles.AdjustToUniversal)); }