| 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 // Creates certificate from subject string. | 22 // Creates certificate from subject string. |
| 23 net::X509Certificate* CreateCertFromSubject(NSString* subject) { | 23 net::X509Certificate* CreateCertFromSubject(NSString* subject) { |
| 24 std::string issuer = ""; | 24 std::string issuer = ""; |
| 25 base::Time start_date; | 25 base::Time start_date; |
| 26 base::Time expiration_date; | 26 base::Time expiration_date; |
| 27 return new net::X509Certificate(base::SysNSStringToUTF8(subject), | 27 return new net::X509Certificate(base::SysNSStringToUTF8(subject), |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 case kSecTrustResultRecoverableTrustFailure: | 143 case kSecTrustResultRecoverableTrustFailure: |
| 144 case kSecTrustResultFatalTrustFailure: | 144 case kSecTrustResultFatalTrustFailure: |
| 145 case kSecTrustResultOtherError: | 145 case kSecTrustResultOtherError: |
| 146 return SECURITY_STYLE_AUTHENTICATION_BROKEN; | 146 return SECURITY_STYLE_AUTHENTICATION_BROKEN; |
| 147 } | 147 } |
| 148 NOTREACHED(); | 148 NOTREACHED(); |
| 149 return SECURITY_STYLE_UNKNOWN; | 149 return SECURITY_STYLE_UNKNOWN; |
| 150 } | 150 } |
| 151 | 151 |
| 152 } // namespace web | 152 } // namespace web |
| OLD | NEW |