| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "chrome/app/signature_validator_win.h" | 5 #include "chrome/app/signature_validator_win.h" |
| 6 | 6 |
| 7 #include <atlstr.h> | 7 #include <atlstr.h> |
| 8 #include <softpub.h> | 8 #include <softpub.h> |
| 9 #include <wincrypt.h> | |
| 10 #include <windows.h> | 9 #include <windows.h> |
| 11 #include <wintrust.h> | 10 #include <wintrust.h> |
| 12 | 11 |
| 13 #include <algorithm> | 12 #include <algorithm> |
| 14 | 13 |
| 15 #include "base/files/file_path.h" | 14 #include "base/files/file_path.h" |
| 16 #include "base/strings/string_number_conversions.h" | 15 #include "base/strings/string_number_conversions.h" |
| 17 #include "base/strings/string_util.h" | 16 #include "base/strings/string_util.h" |
| 18 #include "base/strings/utf_string_conversions.h" | 17 #include "base/strings/utf_string_conversions.h" |
| 19 #include "base/time/time.h" | 18 #include "base/time/time.h" |
| 20 #include "base/win/scoped_handle.h" | 19 #include "base/win/scoped_handle.h" |
| 21 #include "crypto/sha2.h" | 20 #include "crypto/sha2.h" |
| 21 #include "crypto/wincrypt_shim.h" |
| 22 | 22 |
| 23 namespace { | 23 namespace { |
| 24 | 24 |
| 25 bool ExtractPublicKeyHash(const CERT_CONTEXT* cert_context, | 25 bool ExtractPublicKeyHash(const CERT_CONTEXT* cert_context, |
| 26 std::string* public_key_hash) { | 26 std::string* public_key_hash) { |
| 27 public_key_hash->clear(); | 27 public_key_hash->clear(); |
| 28 | 28 |
| 29 CRYPT_BIT_BLOB crypt_blob = | 29 CRYPT_BIT_BLOB crypt_blob = |
| 30 cert_context->pCertInfo->SubjectPublicKeyInfo.PublicKey; | 30 cert_context->pCertInfo->SubjectPublicKeyInfo.PublicKey; |
| 31 | 31 |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 213 // to make sure the cert is current. | 213 // to make sure the cert is current. |
| 214 std::vector<std::string>::const_iterator it = std::find( | 214 std::vector<std::string>::const_iterator it = std::find( |
| 215 expected_hashes.begin(), | 215 expected_hashes.begin(), |
| 216 expected_hashes.end(), | 216 expected_hashes.end(), |
| 217 cert_info.public_key_hash()); | 217 cert_info.public_key_hash()); |
| 218 if (it == expected_hashes.end() || !cert_info.IsValidNow()) | 218 if (it == expected_hashes.end() || !cert_info.IsValidNow()) |
| 219 return false; | 219 return false; |
| 220 | 220 |
| 221 return true; | 221 return true; |
| 222 } | 222 } |
| OLD | NEW |