2 * Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
19 * @author Uladzislau Harbuz (u.harbuz@samsung.com)
20 * @brief Security Context header file
24 #ifndef SECURITYCONTEXT_H
25 #define SECURITYCONTEXT_H
30 #include <cynara/cynara-client.h>
32 #define TA_LOCAL_PATH "/res/tee"
34 class SecurityContext {
38 static constexpr const size_t CYNARA_CACHE_SIZE = 100U;
40 static cynara* initCynara();
41 static cynara* _cynara;
43 static constexpr const char* sysTaPaths[] = {
47 std::string getCaFullPathFromPkgId(char*);
51 SecurityContext(int connFd);
55 * Check if client has Tizen permission for use TEE.
57 * @param privilege Privilege to be checked for client.
58 * @return true if client has permission, otherwise false.
60 bool clientHasCynaraPermission(const std::string &privilege);
63 #endif /*SECURITYCONTEXT_H*/