6c5f9c5710c5def5fa4377ddfaba605da84a4ede
[platform/upstream/connectedhomeip.git] / src / lib / protocols / security / CHIPDummyGroupKeyStore.h
1 /*
2  *
3  *    Copyright (c) 2020 Project CHIP Authors
4  *    Copyright (c) 2016-2017 Nest Labs, Inc.
5  *    All rights reserved.
6  *
7  *    Licensed under the Apache License, Version 2.0 (the "License");
8  *    you may not use this file except in compliance with the License.
9  *    You may obtain a copy of the License at
10  *
11  *        http://www.apache.org/licenses/LICENSE-2.0
12  *
13  *    Unless required by applicable law or agreed to in writing, software
14  *    distributed under the License is distributed on an "AS IS" BASIS,
15  *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  *    See the License for the specific language governing permissions and
17  *    limitations under the License.
18  */
19
20 /**
21  *    @file
22  *      This file defines class, which is used as a default dummy (empty)
23  *      implementation of the group key store.
24  *
25  */
26
27 #ifndef CHIPDUMMYGROUPKEYSTORE_H_
28 #define CHIPDUMMYGROUPKEYSTORE_H_
29
30 #include "CHIPApplicationKeys.h"
31
32 namespace chip {
33 namespace Protocols {
34 namespace Security {
35 namespace AppKeys {
36
37 /**
38  *  @class DummyKeyStore
39  *
40  *  @brief
41  *    The definition of the dummy group key store.
42  *
43  */
44 class DummyGroupKeyStore : public GroupKeyStoreBase
45 {
46 public:
47     DummyGroupKeyStore();
48
49     // Manage application group key material storage.
50     CHIP_ERROR RetrieveGroupKey(uint32_t keyId, ChipGroupKey & key) override;
51     CHIP_ERROR StoreGroupKey(const ChipGroupKey & key) override;
52     CHIP_ERROR DeleteGroupKey(uint32_t keyId) override;
53     CHIP_ERROR DeleteGroupKeysOfAType(uint32_t keyType) override;
54     CHIP_ERROR EnumerateGroupKeys(uint32_t keyType, uint32_t * keyIds, uint8_t keyIdsArraySize, uint8_t & keyCount) override;
55     CHIP_ERROR Clear() override;
56
57 private:
58     // Retrieve and Store LastUsedEpochKeyId value.
59     CHIP_ERROR RetrieveLastUsedEpochKeyId() override;
60     CHIP_ERROR StoreLastUsedEpochKeyId() override;
61
62     // Get current platform UTC time in seconds.
63     CHIP_ERROR GetCurrentUTCTime(uint32_t & utcTime) override;
64 };
65
66 } // namespace AppKeys
67 } // namespace Security
68 } // namespace Protocols
69 } // namespace chip
70
71 #endif /* CHIPDUMMYGROUPKEYSTORE_H_ */