Chromium Code Reviews| Index: components/ownership/owner_key_util.cc |
| diff --git a/components/ownership/owner_key_util.cc b/components/ownership/owner_key_util.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..5bf0795392babc3fd0c9c19e65f9043904b45008 |
| --- /dev/null |
| +++ b/components/ownership/owner_key_util.cc |
| @@ -0,0 +1,62 @@ |
| +// Copyright 2014 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#include "components/ownership/owner_key_util.h" |
| + |
| +#include <limits> |
| + |
| +#include "base/file_util.h" |
| +#include "base/logging.h" |
| +#include "base/path_service.h" |
| +#include "base/sys_info.h" |
| +#include "crypto/rsa_private_key.h" |
| + |
| +#if defined(OS_CHROMEOS) |
| +#include "chromeos/chromeos_paths.h" |
| +#include "components/ownership/owner_key_util_chromeos.h" |
| +#endif // defined(OS_CHROMEOS) |
| + |
| +namespace ownership { |
| + |
| +/////////////////////////////////////////////////////////////////////////// |
| +// PublicKey |
| + |
| +PublicKey::PublicKey() { |
| +} |
| + |
| +PublicKey::~PublicKey() { |
| +} |
| + |
| +/////////////////////////////////////////////////////////////////////////// |
| +// PrivateKey |
| + |
| +PrivateKey::PrivateKey(crypto::RSAPrivateKey* key) : key_(key) { |
| +} |
| + |
| +PrivateKey::~PrivateKey() { |
| +} |
| + |
| +/////////////////////////////////////////////////////////////////////////// |
| +// OwnerKeyUtil |
| + |
| +OwnerKeyUtil* OwnerKeyUtil::Create() { |
| +#if defined(OS_CHROMEOS) |
| + base::FilePath owner_key_path; |
|
erikwright (departed)
2014/08/25 15:51:07
Accept this path as an input from the caller.
ygorshenin1
2014/08/26 14:53:35
Done.
|
| + CHECK(PathService::Get(chromeos::FILE_OWNER_KEY, &owner_key_path)); |
|
stevenjb
2014/08/25 15:57:30
nit: I am not a fan of assertions with side effect
ygorshenin1
2014/08/26 14:53:35
Done.
|
| + return new OwnerKeyUtilChromeOS(owner_key_path); |
|
stevenjb
2014/08/25 15:57:29
nit: You could #ifdef out all of Create for OS_CHR
ygorshenin1
2014/08/26 14:53:35
Done.
|
| +#else |
| + return NULL; |
| +#endif // defined(OS_CHROMEOS) |
| +} |
| + |
| +OwnerKeyUtil::OwnerKeyUtil() { |
| +} |
| + |
| +OwnerKeyUtil::~OwnerKeyUtil() { |
| +} |
| + |
| +/////////////////////////////////////////////////////////////////////////// |
| +// OwnerKeyUtilImpl |
| + |
| +} // namespace ownership |