Groups | Blog | Home
all groups > dotnet security > july 2004 >

dotnet security : GetEffectiveDateString is bugged?



Paolo
7/22/2004 1:47:02 AM
I try to get the validity date of a certificate with GetEffectiveDateString.
It doesn't return the same dates as the
certificate viewer included in Windows but it returns a right date but with a wrong time.
My pc is located in Italy with +1 GMT and daylight saving time.
The certficate viewer in Win reports:
21/07/2004 03.27.27 PM
GetEffectiveDateString reports:
21/07/2004 05.27.27 AM

Why? Pecche'?
Thx a lot.
Joe Kaplan (MVP - ADSI)
7/22/2004 11:10:40 AM
I get this too and other people have complained about it. Mine are usually
off by 3 hours. I'm not exactly sure what the problem is.

Under the hood, some C++ code is reading the CAPI CERT_INFO structure and
taking the two FILETIME structures for the two cert dates and pasing them to
the constructor on the .NET DateTime that takes a long/tick count. It seems
like it would be better if the code called DateTime.FromFileTime instead,
but I'm not sure if that would fix the problem or not.

I'm hoping the story is better in Whidbey (haven't tried yet with the new
X509 class). Why this class was designed to return a string instead of a
DateTime (it is calling ToString() on the DateTime under the hood!) is
beyond me.

Joe K.

[quoted text, click to view]

AddThis Social Bookmark Button