Skip to content

Commit

Permalink
Merge pull request #166 from thezonie/upstream/utcExpirationDate
Browse files Browse the repository at this point in the history
Setting the Expiration Date time zone to UTC
  • Loading branch information
nabla-c0d3 authored Jul 9, 2018
2 parents 8588116 + ab1ee30 commit 49d48d5
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
5 changes: 3 additions & 2 deletions TrustKit/parse_configuration.m
Original file line number Diff line number Diff line change
Expand Up @@ -132,9 +132,10 @@
NSString *expirationDateStr = domainPinningPolicy[kTSKExpirationDate];
if (expirationDateStr != nil)
{
// Convert the string in the yyyy-MM-dd format into an actual date
// Convert the string in the yyyy-MM-dd format into an actual date in UTC
NSDateFormatter *dateFormat = [[NSDateFormatter alloc] init];
[dateFormat setDateFormat:@"yyyy-MM-dd"];
dateFormat.dateFormat = @"yyyy-MM-dd";
dateFormat.timeZone = [NSTimeZone timeZoneForSecondsFromGMT:0];
NSDate *expirationDate = [dateFormat dateFromString:expirationDateStr];
domainFinalConfiguration[kTSKExpirationDate] = expirationDate;
}
Expand Down
3 changes: 2 additions & 1 deletion TrustKitTests/TSKPinConfigurationTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,8 @@ - (void)testGetConfigurationPinningEnabledWithExpirationDate

// Validate the content of the config
NSDateFormatter *dateFormat = [[NSDateFormatter alloc] init];
[dateFormat setDateFormat:@"yyyy-MM-dd"];
dateFormat.dateFormat = @"yyyy-MM-dd";
dateFormat.timeZone = [NSTimeZone timeZoneForSecondsFromGMT:0];
NSDate *expirationDate = [dateFormat dateFromString:expirationDateStr];

NSDictionary *serverConfig = trustKitConfig[kTSKPinnedDomains][serverConfigKey];
Expand Down
3 changes: 2 additions & 1 deletion TrustKitTests/TSKReporterTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,8 @@ - (void)testSendReportFromValidationReport


NSDateFormatter *dateFormat = [[NSDateFormatter alloc] init];
[dateFormat setDateFormat:@"yyyy-MM-dd"];
dateFormat.dateFormat = @"yyyy-MM-dd";
dateFormat.timeZone = [NSTimeZone timeZoneForSecondsFromGMT:0];
NSDate *expirationDate = [dateFormat dateFromString:expirationDateStr];

TSKPinningValidatorResult *res;
Expand Down

0 comments on commit 49d48d5

Please sign in to comment.