cert_verify_proc_ios.h 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. // Copyright (c) 2016 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #ifndef NET_CERT_CERT_VERIFY_PROC_IOS_H_
  5. #define NET_CERT_CERT_VERIFY_PROC_IOS_H_
  6. #include "net/cert/cert_verify_proc.h"
  7. #include <Security/Security.h>
  8. #include "net/cert/cert_status_flags.h"
  9. namespace net {
  10. // Performs certificate path construction and validation using iOS's
  11. // Security.framework.
  12. class CertVerifyProcIOS : public CertVerifyProc {
  13. public:
  14. CertVerifyProcIOS();
  15. // Maps a CFError result from SecTrustEvaluateWithError to CertStatus flags.
  16. // This should only be called if the SecTrustEvaluateWithError return value
  17. // indicated that the certificate is not trusted.
  18. static CertStatus GetCertFailureStatusFromError(CFErrorRef error);
  19. bool SupportsAdditionalTrustAnchors() const override;
  20. protected:
  21. ~CertVerifyProcIOS() override;
  22. private:
  23. #if !defined(__IPHONE_12_0) || __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_12_0
  24. // Returns error CertStatus from the given |trust| object. Returns
  25. // CERT_STATUS_INVALID if the trust is null.
  26. // TODO(mattm): move this to an anonymous namespace function.
  27. static CertStatus GetCertFailureStatusFromTrust(SecTrustRef trust);
  28. #endif
  29. int VerifyInternal(X509Certificate* cert,
  30. const std::string& hostname,
  31. const std::string& ocsp_response,
  32. const std::string& sct_list,
  33. int flags,
  34. CRLSet* crl_set,
  35. const CertificateList& additional_trust_anchors,
  36. CertVerifyResult* verify_result,
  37. const NetLogWithSource& net_log) override;
  38. };
  39. } // namespace net
  40. #endif // NET_CERT_CERT_VERIFY_PROC_IOS_H_