• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Need localization-proof method of transporting dates.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Need localization-proof method of transporting dates.


  • Subject: Need localization-proof method of transporting dates.
  • From: Graham Cox <email@hidden>
  • Date: Sat, 4 Apr 2009 23:01:02 +1100

My app encodes expiry dates for demo versions, etc.

One problem I've had occasional reports of is that the expiry is prematurely detected, and it seems to be on systems with system language set other than English. I need to store and check the dates in a way that is not sensitive to this. I thought I was, yet the reports persist.

Here's what I'm doing:

The stored date originally comes from a NSDatePicker control, textual with stepper. I retrieve the date using its -dateValue method.

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.

At runtime, the date is recovered and verified by rehashing and comparing the hash, then the date value is simply compared to see if the current date is before or after it using [[NSDate date] timeIntervalSinceDate:expiryDate] (if negative, hasn't expired).

Can anyone spot any problem with this approach? Note that the SHA-1 check appears to pass OK - it's the date comparison that seems to be wrong. Unfortunately I can't reproduce the bug locally so I'm relying on reports from relatively non-technical testers who aren't able to give me much to go on.

--Graham


_______________________________________________

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


  • Follow-Ups:
    • Re: Need localization-proof method of transporting dates.
      • From: Christopher Kane <email@hidden>
    • Re: Need localization-proof method of transporting dates.
      • From: Marcel Weiher <email@hidden>
    • Re: Need localization-proof method of transporting dates.
      • From: Tommy Nordgren <email@hidden>
    • Re: Need localization-proof method of transporting dates.
      • From: Ken Thomases <email@hidden>
  • Prev by Date: RE: Best Practice for reading a string with NSScanner
  • Next by Date: Re: Best Practice for reading a string with NSScanner
  • Previous by thread: Re: Where is "Accessibility Reference for Assistive Applications"?
  • Next by thread: Re: Need localization-proof method of transporting dates.
  • Index(es):
    • Date
    • Thread