OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/base/keygen_handler.h" | 5 #include "net/base/keygen_handler.h" |
6 | 6 |
7 #include <windows.h> | 7 #include <windows.h> |
8 #include <rpc.h> | 8 #include <rpc.h> |
9 | 9 |
10 #include <list> | 10 #include <list> |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 if (key_container.key_id_.empty()) | 176 if (key_container.key_id_.empty()) |
177 return std::string(); | 177 return std::string(); |
178 | 178 |
179 // Only create new key containers, so that existing key containers are not | 179 // Only create new key containers, so that existing key containers are not |
180 // overwritten. | 180 // overwritten. |
181 if (crypto::CryptAcquireContextLocked(key_container.provider_.receive(), | 181 if (crypto::CryptAcquireContextLocked(key_container.provider_.receive(), |
182 key_container.key_id_.c_str(), NULL, PROV_RSA_FULL, | 182 key_container.key_id_.c_str(), NULL, PROV_RSA_FULL, |
183 CRYPT_SILENT | CRYPT_NEWKEYSET)) | 183 CRYPT_SILENT | CRYPT_NEWKEYSET)) |
184 break; | 184 break; |
185 | 185 |
186 if (GetLastError() != NTE_BAD_KEYSET) { | 186 if (GetLastError() != static_cast<DWORD>(NTE_BAD_KEYSET)) { |
187 LOG(ERROR) << "Keygen failed: Couldn't acquire a CryptoAPI provider " | 187 LOG(ERROR) << "Keygen failed: Couldn't acquire a CryptoAPI provider " |
188 "context: " << GetLastError(); | 188 "context: " << GetLastError(); |
189 return std::string(); | 189 return std::string(); |
190 } | 190 } |
191 } | 191 } |
192 if (attempt == kMaxAttempts) { | 192 if (attempt == kMaxAttempts) { |
193 LOG(ERROR) << "Keygen failed: Couldn't acquire a CryptoAPI provider " | 193 LOG(ERROR) << "Keygen failed: Couldn't acquire a CryptoAPI provider " |
194 "context: Max retries exceeded"; | 194 "context: Max retries exceeded"; |
195 return std::string(); | 195 return std::string(); |
196 } | 196 } |
(...skipping 16 matching lines...) Expand all Loading... |
213 | 213 |
214 std::string result; | 214 std::string result; |
215 base::Base64Encode(spkac, &result); | 215 base::Base64Encode(spkac, &result); |
216 | 216 |
217 VLOG(1) << "Keygen succeeded"; | 217 VLOG(1) << "Keygen succeeded"; |
218 return result; | 218 return result; |
219 } | 219 } |
220 } | 220 } |
221 | 221 |
222 } // namespace net | 222 } // namespace net |
OLD | NEW |