Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(265)

Side by Side Diff: chrome/app/signature_validator_win_unittest.cc

Issue 448853002: Move StringToLowerASCII to base namespace (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 <atlstr.h> 5 #include <atlstr.h>
6 #include <wincrypt.h> 6 #include <wincrypt.h>
7 #include <windows.h> 7 #include <windows.h>
8 #include <wintrust.h> 8 #include <wintrust.h>
9 9
10 #include "base/base_paths.h" 10 #include "base/base_paths.h"
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 size_t public_key_length = blob.cbData; 78 size_t public_key_length = blob.cbData;
79 uint8* public_key = blob.pbData; 79 uint8* public_key = blob.pbData;
80 80
81 uint8 hash[crypto::kSHA256Length] = {0}; 81 uint8 hash[crypto::kSHA256Length] = {0};
82 82
83 base::StringPiece key_bytes(reinterpret_cast<char*>(public_key), 83 base::StringPiece key_bytes(reinterpret_cast<char*>(public_key),
84 public_key_length); 84 public_key_length);
85 crypto::SHA256HashString(key_bytes, hash, crypto::kSHA256Length); 85 crypto::SHA256HashString(key_bytes, hash, crypto::kSHA256Length);
86 86
87 std::string public_key_hash = 87 std::string public_key_hash =
88 StringToLowerASCII(base::HexEncode(hash, arraysize(hash))); 88 base::StringToLowerASCII(base::HexEncode(hash, arraysize(hash)));
89 expected_hashes_.push_back(public_key_hash); 89 expected_hashes_.push_back(public_key_hash);
90 } 90 }
91 91
92 void RunTest(const wchar_t* dll_filename, bool isValid, bool isGoogle) { 92 void RunTest(const wchar_t* dll_filename, bool isValid, bool isGoogle) {
93 base::FilePath full_dll_path = GetTestDLLsDirectory().Append(dll_filename); 93 base::FilePath full_dll_path = GetTestDLLsDirectory().Append(dll_filename);
94 ASSERT_EQ(isValid, VerifyAuthenticodeSignature(full_dll_path)); 94 ASSERT_EQ(isValid, VerifyAuthenticodeSignature(full_dll_path));
95 ASSERT_EQ(isGoogle, VerifySignerIsGoogle(full_dll_path, kGoogleCertIssuer, 95 ASSERT_EQ(isGoogle, VerifySignerIsGoogle(full_dll_path, kGoogleCertIssuer,
96 expected_hashes_)); 96 expected_hashes_));
97 } 97 }
98 98
(...skipping 23 matching lines...) Expand all
122 TEST_F(SignatureValidatorTest, CertPinningTest) { 122 TEST_F(SignatureValidatorTest, CertPinningTest) {
123 RunTest(L"different_hash.dll", true, false); 123 RunTest(L"different_hash.dll", true, false);
124 } 124 }
125 125
126 TEST_F(SignatureValidatorTest, ExpiredCertTest) { 126 TEST_F(SignatureValidatorTest, ExpiredCertTest) {
127 //TODO(caitkp): Figure out how to sign a dll with an expired cert. 127 //TODO(caitkp): Figure out how to sign a dll with an expired cert.
128 RunTest(L"expired.dll", false, false); 128 RunTest(L"expired.dll", false, false);
129 } 129 }
130 130
131 131
OLDNEW
« no previous file with comments | « chrome/app/signature_validator_win.cc ('k') | chrome/browser/chromeos/customization_document.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698