1 // Copyright 2014 The Chromium Authors
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef COMPONENTS_OWNERSHIP_OWNER_KEY_UTIL_IMPL_H_
6 #define COMPONENTS_OWNERSHIP_OWNER_KEY_UTIL_IMPL_H_
10 #include "base/compiler_specific.h"
11 #include "base/files/file_path.h"
12 #include "components/ownership/owner_key_util.h"
13 #include "components/ownership/ownership_export.h"
17 // Implementation of OwnerKeyUtil which imports public part of the
18 // owner key from a filesystem.
19 class OWNERSHIP_EXPORT OwnerKeyUtilImpl : public OwnerKeyUtil {
21 explicit OwnerKeyUtilImpl(const base::FilePath& public_key_file);
23 OwnerKeyUtilImpl(const OwnerKeyUtilImpl&) = delete;
24 OwnerKeyUtilImpl& operator=(const OwnerKeyUtilImpl&) = delete;
26 // OwnerKeyUtil implementation:
27 scoped_refptr<PublicKey> ImportPublicKey() override;
28 crypto::ScopedSECKEYPrivateKey GenerateKeyPair(PK11SlotInfo* slot) override;
29 crypto::ScopedSECKEYPrivateKey FindPrivateKeyInSlot(
30 const std::vector<uint8_t>& key,
31 PK11SlotInfo* slot) override;
32 bool IsPublicKeyPresent() override;
35 ~OwnerKeyUtilImpl() override;
37 // The file that holds the public key.
38 base::FilePath public_key_file_;
41 } // namespace ownership
43 #endif // COMPONENTS_OWNERSHIP_OWNER_KEY_UTIL_IMPL_H_