| OLD | NEW |
| 1 // Copyright (c) 2016 The Chromium Authors. All rights reserved. | 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 | 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 #include "net/cert/cert_verify_proc_ios.h" | 5 #include "net/cert/cert_verify_proc_ios.h" |
| 6 | 6 |
| 7 #include <CommonCrypto/CommonDigest.h> | 7 #include <CommonCrypto/CommonDigest.h> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/mac/scoped_cftyperef.h" | 10 #include "base/mac/scoped_cftyperef.h" |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 if (i == 0) { | 118 if (i == 0) { |
| 119 verified_cert = chain_cert; | 119 verified_cert = chain_cert; |
| 120 } else { | 120 } else { |
| 121 verified_chain.push_back(chain_cert); | 121 verified_chain.push_back(chain_cert); |
| 122 } | 122 } |
| 123 | 123 |
| 124 std::string der_bytes; | 124 std::string der_bytes; |
| 125 if (!X509Certificate::GetDEREncoded(chain_cert, &der_bytes)) | 125 if (!X509Certificate::GetDEREncoded(chain_cert, &der_bytes)) |
| 126 return; | 126 return; |
| 127 const uint8_t* bytes = reinterpret_cast<const uint8_t*>(der_bytes.data()); | 127 const uint8_t* bytes = reinterpret_cast<const uint8_t*>(der_bytes.data()); |
| 128 ScopedX509 x509_cert(d2i_X509(NULL, &bytes, der_bytes.size())); | 128 bssl::UniquePtr<X509> x509_cert(d2i_X509(NULL, &bytes, der_bytes.size())); |
| 129 | 129 |
| 130 base::StringPiece spki_bytes; | 130 base::StringPiece spki_bytes; |
| 131 if (!asn1::ExtractSPKIFromDERCert(der_bytes, &spki_bytes)) | 131 if (!asn1::ExtractSPKIFromDERCert(der_bytes, &spki_bytes)) |
| 132 continue; | 132 continue; |
| 133 | 133 |
| 134 HashValue sha1(HASH_VALUE_SHA1); | 134 HashValue sha1(HASH_VALUE_SHA1); |
| 135 CC_SHA1(spki_bytes.data(), spki_bytes.size(), sha1.data()); | 135 CC_SHA1(spki_bytes.data(), spki_bytes.size(), sha1.data()); |
| 136 verify_result->public_key_hashes.push_back(sha1); | 136 verify_result->public_key_hashes.push_back(sha1); |
| 137 | 137 |
| 138 HashValue sha256(HASH_VALUE_SHA256); | 138 HashValue sha256(HASH_VALUE_SHA256); |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 299 | 299 |
| 300 verify_result->is_issued_by_known_root = false; | 300 verify_result->is_issued_by_known_root = false; |
| 301 | 301 |
| 302 if (IsCertStatusError(verify_result->cert_status)) | 302 if (IsCertStatusError(verify_result->cert_status)) |
| 303 return MapCertStatusToNetError(verify_result->cert_status); | 303 return MapCertStatusToNetError(verify_result->cert_status); |
| 304 | 304 |
| 305 return OK; | 305 return OK; |
| 306 } | 306 } |
| 307 | 307 |
| 308 } // namespace net | 308 } // namespace net |
| OLD | NEW |