| 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_android.h" | 5 #include "net/cert/cert_verify_proc_android.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 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 } | 104 } |
| 105 } | 105 } |
| 106 | 106 |
| 107 // Extract the public key hashes. | 107 // Extract the public key hashes. |
| 108 for (size_t i = 0; i < verified_chain.size(); i++) { | 108 for (size_t i = 0; i < verified_chain.size(); i++) { |
| 109 base::StringPiece spki_bytes; | 109 base::StringPiece spki_bytes; |
| 110 if (!asn1::ExtractSPKIFromDERCert(verified_chain[i], &spki_bytes)) | 110 if (!asn1::ExtractSPKIFromDERCert(verified_chain[i], &spki_bytes)) |
| 111 continue; | 111 continue; |
| 112 | 112 |
| 113 HashValue sha1(HASH_VALUE_SHA1); | 113 HashValue sha1(HASH_VALUE_SHA1); |
| 114 base::SHA1HashBytes(reinterpret_cast<const uint8*>(spki_bytes.data()), | 114 base::SHA1HashBytes(reinterpret_cast<const uint8_t*>(spki_bytes.data()), |
| 115 spki_bytes.size(), sha1.data()); | 115 spki_bytes.size(), sha1.data()); |
| 116 verify_result->public_key_hashes.push_back(sha1); | 116 verify_result->public_key_hashes.push_back(sha1); |
| 117 | 117 |
| 118 HashValue sha256(HASH_VALUE_SHA256); | 118 HashValue sha256(HASH_VALUE_SHA256); |
| 119 crypto::SHA256HashString(spki_bytes, sha256.data(), crypto::kSHA256Length); | 119 crypto::SHA256HashString(spki_bytes, sha256.data(), crypto::kSHA256Length); |
| 120 verify_result->public_key_hashes.push_back(sha256); | 120 verify_result->public_key_hashes.push_back(sha256); |
| 121 } | 121 } |
| 122 | 122 |
| 123 return true; | 123 return true; |
| 124 } | 124 } |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 179 NOTREACHED(); | 179 NOTREACHED(); |
| 180 return ERR_FAILED; | 180 return ERR_FAILED; |
| 181 } | 181 } |
| 182 if (IsCertStatusError(verify_result->cert_status)) | 182 if (IsCertStatusError(verify_result->cert_status)) |
| 183 return MapCertStatusToNetError(verify_result->cert_status); | 183 return MapCertStatusToNetError(verify_result->cert_status); |
| 184 | 184 |
| 185 return OK; | 185 return OK; |
| 186 } | 186 } |
| 187 | 187 |
| 188 } // namespace net | 188 } // namespace net |
| OLD | NEW |