08ab78eefda16873eab6b622f1b85feb6febd4ee
[platform/core/security/key-manager.git] / src / manager / crypto / platform / decider.h
1 /*
2  *  Copyright (c) 2015-2019 Samsung Electronics Co., Ltd. All rights reserved
3  *
4  *  Licensed under the Apache License, Version 2.0 (the "License");
5  *  you may not use this file except in compliance with the License.
6  *  You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  *  Unless required by applicable law or agreed to in writing, software
11  *  distributed under the License is distributed on an "AS IS" BASIS,
12  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  *  See the License for the specific language governing permissions and
14  *  limitations under the License
15  */
16 /*
17  * @file       decider.h
18  * @author     BartÅ‚omiej Grzelewski (b.grzelewski@samsung.com)
19  * @version    1.0
20  */
21 #pragma once
22
23 #include <ckm/ckm-type.h>
24
25 #include <crypto-backend.h>
26
27 #include <generic-backend/gstore.h>
28
29 #include <sw-backend/store.h>
30 #ifdef TZ_BACKEND_ENABLED
31 #include <tz-backend/store.h>
32 #endif
33
34 #include <token.h>
35
36 namespace CKM {
37 namespace Crypto {
38
39 class Decider final {
40 public:
41         Decider();
42         GStore &getStore(const Token &token);
43         GStore &getStore(DataType data, const Policy &policy, bool encrypted = false);
44         GStore &getStore(const Policy &policyPrv);
45
46 private:
47         GStore &getStore(CryptoBackend id);
48
49         SW::Store m_swStore;
50 #ifdef TZ_BACKEND_ENABLED
51         TZ::Store m_tzStore;
52 #endif
53 };
54
55 } // Crypto
56 } // CKM