Re: Need localization-proof method of transporting dates.
Re: Need localization-proof method of transporting dates.
- Subject: Re: Need localization-proof method of transporting dates.
- From: Greg Guerin <email@hidden>
- Date: Sat, 4 Apr 2009 12:02:26 -0700
Graham Cox wrote:
The date, along with other data, is digitally signed with a SHA-1
hash, which in turn is based on the object's -hash method. As far
as I could tell, the -hash method returns a value that is sensitive
to the actual stored date, but not to the date localization on the
system.
An object's -hash method is not guaranteed to return a unique value.
Different objects can have the same hash as other objects of the same
type, or of different types. Therefore, if you are calculating a
SHA-1 hash of the -hash value returned from the NSDate, your
authentication can be spoofed by an unknown number of other NSDate
objects that return the same value from -hash.
In this situation, where it only affects the expiry of a demo
version, this probably isn't a big problem. It's also possible I've
misinterpreted how the NSDate's -hash method is being used.
By the way, if the list archives are correct, you are in a time-zone
at GMT+1100. Evidence is the "Date:" line here:
http://lists.apple.com/archives/cocoa-dev/2009/Apr/msg00292.html
Second, I opened a plist in Property List Editor and added a key of
type Date, with the value set to 1/1/70. When written out and opened
in a text editor, it showed this:
<date>1970-01-01T07:00:00Z</date>
From this, one might infer I'm in a time-zone at GMT-0700, which
would be correct.
I suspect that when you write an expiry NSDate to a plist file, it
represents your local date and time. This expiry is then expiring at
your local time, not the recipient's local time. However, since it's
later in your location than almost anywhere else in the world, the
recipient perceives the expiration as premature.
The problem is not in the localization of NSDate. The problem is in
not accounting for time-zone differences between your location and
the user's location.
-- GG
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden