TSKPinningValidatorResult.m 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. /*
  2. TSKPinningValidator.h
  3. TrustKit
  4. Copyright 2015 The TrustKit Project Authors
  5. Licensed under the MIT license, see associated LICENSE file for terms.
  6. See AUTHORS file for the list of project authors.
  7. */
  8. #import "TSKPinningValidatorResult.h"
  9. #import "Reporting/reporting_utils.h"
  10. @implementation TSKPinningValidatorResult
  11. - (instancetype _Nullable)initWithServerHostname:(NSString * _Nonnull)serverHostname
  12. serverTrust:(SecTrustRef _Nonnull)serverTrust
  13. validationResult:(TSKTrustEvaluationResult)validationResult
  14. finalTrustDecision:(TSKTrustDecision)finalTrustDecision
  15. validationDuration:(NSTimeInterval)validationDuration
  16. {
  17. NSParameterAssert(serverHostname);
  18. NSParameterAssert(serverTrust);
  19. self = [super init];
  20. if (self) {
  21. _serverHostname = serverHostname;
  22. _evaluationResult = validationResult;
  23. _finalTrustDecision = finalTrustDecision;
  24. _validationDuration = validationDuration;
  25. // Convert the server trust to a certificate chain as soon as we get it, as the trust object sometimes gets freed right after the authentication challenge has been handled
  26. _certificateChain = convertTrustToPemArray(serverTrust);
  27. }
  28. return self;
  29. }
  30. @end