OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "components/ownership/owner_key_util_impl.h" | 5 #include "components/ownership/owner_key_util_impl.h" |
6 | 6 |
7 #include <limits> | 7 #include <limits> |
8 | 8 |
9 #include "base/files/file_util.h" | 9 #include "base/files/file_util.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 } | 43 } |
44 | 44 |
45 // Get the key data off of disk | 45 // Get the key data off of disk |
46 int data_read = | 46 int data_read = |
47 base::ReadFile(public_key_file_, | 47 base::ReadFile(public_key_file_, |
48 reinterpret_cast<char*>(vector_as_array(output)), | 48 reinterpret_cast<char*>(vector_as_array(output)), |
49 safe_file_size); | 49 safe_file_size); |
50 return data_read == safe_file_size; | 50 return data_read == safe_file_size; |
51 } | 51 } |
52 | 52 |
53 #if defined(USE_NSS) | 53 #if defined(USE_NSS_CERTS) |
54 crypto::RSAPrivateKey* OwnerKeyUtilImpl::FindPrivateKeyInSlot( | 54 crypto::RSAPrivateKey* OwnerKeyUtilImpl::FindPrivateKeyInSlot( |
55 const std::vector<uint8>& key, | 55 const std::vector<uint8>& key, |
56 PK11SlotInfo* slot) { | 56 PK11SlotInfo* slot) { |
57 return crypto::RSAPrivateKey::FindFromPublicKeyInfoInSlot(key, slot); | 57 return crypto::RSAPrivateKey::FindFromPublicKeyInfoInSlot(key, slot); |
58 } | 58 } |
59 #endif // defined(USE_NSS) | 59 #endif // defined(USE_NSS_CERTS) |
60 | 60 |
61 bool OwnerKeyUtilImpl::IsPublicKeyPresent() { | 61 bool OwnerKeyUtilImpl::IsPublicKeyPresent() { |
62 return base::PathExists(public_key_file_); | 62 return base::PathExists(public_key_file_); |
63 } | 63 } |
64 | 64 |
65 } // namespace ownership | 65 } // namespace ownership |
OLD | NEW |