OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_openssl.h" | 5 #include "net/cert/cert_verify_proc_openssl.h" |
6 | 6 |
7 #include <openssl/x509v3.h> | 7 #include <openssl/x509v3.h> |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 std::string der_data; | 163 std::string der_data; |
164 if (!X509Certificate::GetDEREncoded(cert, &der_data)) | 164 if (!X509Certificate::GetDEREncoded(cert, &der_data)) |
165 continue; | 165 continue; |
166 | 166 |
167 base::StringPiece der_bytes(der_data); | 167 base::StringPiece der_bytes(der_data); |
168 base::StringPiece spki_bytes; | 168 base::StringPiece spki_bytes; |
169 if (!asn1::ExtractSPKIFromDERCert(der_bytes, &spki_bytes)) | 169 if (!asn1::ExtractSPKIFromDERCert(der_bytes, &spki_bytes)) |
170 continue; | 170 continue; |
171 | 171 |
172 HashValue sha1(HASH_VALUE_SHA1); | 172 HashValue sha1(HASH_VALUE_SHA1); |
173 base::SHA1HashBytes(reinterpret_cast<const uint8*>(spki_bytes.data()), | 173 base::SHA1HashBytes(reinterpret_cast<const uint8_t*>(spki_bytes.data()), |
174 spki_bytes.size(), sha1.data()); | 174 spki_bytes.size(), sha1.data()); |
175 hashes->push_back(sha1); | 175 hashes->push_back(sha1); |
176 | 176 |
177 HashValue sha256(HASH_VALUE_SHA256); | 177 HashValue sha256(HASH_VALUE_SHA256); |
178 crypto::SHA256HashString(spki_bytes, sha256.data(), crypto::kSHA256Length); | 178 crypto::SHA256HashString(spki_bytes, sha256.data(), crypto::kSHA256Length); |
179 hashes->push_back(sha256); | 179 hashes->push_back(sha256); |
180 } | 180 } |
181 } | 181 } |
182 | 182 |
183 } // namespace | 183 } // namespace |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
243 | 243 |
244 GetCertChainInfo(ctx.get(), verify_result); | 244 GetCertChainInfo(ctx.get(), verify_result); |
245 AppendPublicKeyHashes(ctx.get(), &verify_result->public_key_hashes); | 245 AppendPublicKeyHashes(ctx.get(), &verify_result->public_key_hashes); |
246 if (IsCertStatusError(verify_result->cert_status)) | 246 if (IsCertStatusError(verify_result->cert_status)) |
247 return MapCertStatusToNetError(verify_result->cert_status); | 247 return MapCertStatusToNetError(verify_result->cert_status); |
248 | 248 |
249 return OK; | 249 return OK; |
250 } | 250 } |
251 | 251 |
252 } // namespace net | 252 } // namespace net |
OLD | NEW |