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 "chrome/browser/chromeos/settings/owner_key_util.h" | 5 #include "chrome/browser/chromeos/settings/owner_key_util.h" |
6 | 6 |
7 #include <limits> | 7 #include <limits> |
8 | 8 |
9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 int32 safe_file_size = static_cast<int32>(file_size); | 51 int32 safe_file_size = static_cast<int32>(file_size); |
52 | 52 |
53 output->resize(safe_file_size); | 53 output->resize(safe_file_size); |
54 | 54 |
55 if (safe_file_size == 0) { | 55 if (safe_file_size == 0) { |
56 LOG(WARNING) << "Public key file is empty. This seems wrong."; | 56 LOG(WARNING) << "Public key file is empty. This seems wrong."; |
57 return false; | 57 return false; |
58 } | 58 } |
59 | 59 |
60 // Get the key data off of disk | 60 // Get the key data off of disk |
61 int data_read = base::ReadFile( | 61 int data_read = file_util::ReadFile( |
62 key_file_, | 62 key_file_, |
63 reinterpret_cast<char*>(vector_as_array(output)), | 63 reinterpret_cast<char*>(vector_as_array(output)), |
64 safe_file_size); | 64 safe_file_size); |
65 return data_read == safe_file_size; | 65 return data_read == safe_file_size; |
66 } | 66 } |
67 | 67 |
68 crypto::RSAPrivateKey* OwnerKeyUtilImpl::FindPrivateKey( | 68 crypto::RSAPrivateKey* OwnerKeyUtilImpl::FindPrivateKey( |
69 const std::vector<uint8>& key) { | 69 const std::vector<uint8>& key) { |
70 return crypto::RSAPrivateKey::FindFromPublicKeyInfo(key); | 70 return crypto::RSAPrivateKey::FindFromPublicKeyInfo(key); |
71 } | 71 } |
72 | 72 |
73 bool OwnerKeyUtilImpl::IsPublicKeyPresent() { | 73 bool OwnerKeyUtilImpl::IsPublicKeyPresent() { |
74 return base::PathExists(key_file_); | 74 return base::PathExists(key_file_); |
75 } | 75 } |
76 | 76 |
77 } // namespace chromeos | 77 } // namespace chromeos |
OLD | NEW |