| 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 <keythi.h> | 7 #include <keythi.h> |
| 8 #include <limits> | 8 #include <limits> |
| 9 | 9 |
| 10 #include "base/files/file_util.h" | 10 #include "base/files/file_util.h" |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 crypto::ScopedSECKEYPrivateKey OwnerKeyUtilImpl::FindPrivateKeyInSlot( | 56 crypto::ScopedSECKEYPrivateKey OwnerKeyUtilImpl::FindPrivateKeyInSlot( |
| 57 const std::vector<uint8_t>& key, | 57 const std::vector<uint8_t>& key, |
| 58 PK11SlotInfo* slot) { | 58 PK11SlotInfo* slot) { |
| 59 if (!slot) | 59 if (!slot) |
| 60 return nullptr; | 60 return nullptr; |
| 61 | 61 |
| 62 crypto::ScopedSECKEYPrivateKey private_key( | 62 crypto::ScopedSECKEYPrivateKey private_key( |
| 63 crypto::FindNSSKeyFromPublicKeyInfoInSlot(key, slot)); | 63 crypto::FindNSSKeyFromPublicKeyInfoInSlot(key, slot)); |
| 64 if (!private_key || SECKEY_GetPrivateKeyType(private_key.get()) != rsaKey) | 64 if (!private_key || SECKEY_GetPrivateKeyType(private_key.get()) != rsaKey) |
| 65 return nullptr; | 65 return nullptr; |
| 66 return private_key.Pass(); | 66 return private_key; |
| 67 } | 67 } |
| 68 | 68 |
| 69 bool OwnerKeyUtilImpl::IsPublicKeyPresent() { | 69 bool OwnerKeyUtilImpl::IsPublicKeyPresent() { |
| 70 return base::PathExists(public_key_file_); | 70 return base::PathExists(public_key_file_); |
| 71 } | 71 } |
| 72 | 72 |
| 73 } // namespace ownership | 73 } // namespace ownership |
| OLD | NEW |