OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #import "ios/web/web_state/wk_web_view_security_util.h" | 5 #import "ios/web/web_state/wk_web_view_security_util.h" |
6 | 6 |
7 #include "base/mac/scoped_cftyperef.h" | 7 #include "base/mac/scoped_cftyperef.h" |
8 #include "base/strings/sys_string_conversions.h" | 8 #include "base/strings/sys_string_conversions.h" |
9 #include "net/cert/x509_certificate.h" | 9 #include "net/cert/x509_certificate.h" |
10 #include "net/ssl/ssl_info.h" | 10 #include "net/ssl/ssl_info.h" |
11 | 11 |
12 namespace web { | 12 namespace web { |
13 | 13 |
14 // This key was determined by inspecting userInfo dict of an SSL error. | 14 // These keys were determined by inspecting userInfo dict of an SSL error. |
15 NSString* const kNSErrorPeerCertificateChainKey = | 15 NSString* const kNSErrorPeerCertificateChainKey = |
16 @"NSErrorPeerCertificateChainKey"; | 16 @"NSErrorPeerCertificateChainKey"; |
17 | 17 NSString* const kNSErrorFailingURLKey = @"NSErrorFailingURLKey"; |
18 } | 18 } |
19 | 19 |
20 namespace { | 20 namespace { |
21 | 21 |
22 // Maps NSError code to net::CertStatus. | 22 // Maps NSError code to net::CertStatus. |
23 net::CertStatus GetCertStatusFromNSErrorCode(NSInteger code) { | 23 net::CertStatus GetCertStatusFromNSErrorCode(NSInteger code) { |
24 switch (code) { | 24 switch (code) { |
25 // Regardless of real certificate problem the system always returns | 25 // Regardless of real certificate problem the system always returns |
26 // NSURLErrorServerCertificateUntrusted. The mapping is done in case this | 26 // NSURLErrorServerCertificateUntrusted. The mapping is done in case this |
27 // bug is fixed (rdar://18517043). | 27 // bug is fixed (rdar://18517043). |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 case kSecTrustResultRecoverableTrustFailure: | 135 case kSecTrustResultRecoverableTrustFailure: |
136 case kSecTrustResultFatalTrustFailure: | 136 case kSecTrustResultFatalTrustFailure: |
137 case kSecTrustResultOtherError: | 137 case kSecTrustResultOtherError: |
138 return SECURITY_STYLE_AUTHENTICATION_BROKEN; | 138 return SECURITY_STYLE_AUTHENTICATION_BROKEN; |
139 } | 139 } |
140 NOTREACHED(); | 140 NOTREACHED(); |
141 return SECURITY_STYLE_UNKNOWN; | 141 return SECURITY_STYLE_UNKNOWN; |
142 } | 142 } |
143 | 143 |
144 } // namespace web | 144 } // namespace web |
OLD | NEW |