1 //******************************************************************
\r
3 // Copyright 2015 Samsung Electronics All Rights Reserved.
\r
5 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
\r
7 // Licensed under the Apache License, Version 2.0 (the "License");
\r
8 // you may not use this file except in compliance with the License.
\r
9 // You may obtain a copy of the License at
\r
11 // http://www.apache.org/licenses/LICENSE-2.0
\r
13 // Unless required by applicable law or agreed to in writing, software
\r
14 // distributed under the License is distributed on an "AS IS" BASIS,
\r
15 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
\r
16 // See the License for the specific language governing permissions and
\r
17 // limitations under the License.
\r
19 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
\r
21 #ifndef ENROLLEE_SECURITY_H_
\r
22 #define ENROLLEE_SECURITY_H_
\r
24 #include <functional>
\r
26 #include "escommon.h"
\r
27 #include "OCProvisioningManager.h"
\r
33 #define ENROLEE_SECURITY_TAG "ENROLEE_SECURITY"
\r
35 class RemoteEnrolleeResource;
\r
36 class OCSecureResource;
\r
39 * This class contains the methods needed for security layer interaction.
\r
41 * @see EnrolleeSecurity
\r
43 class EnrolleeSecurity
\r
46 EnrolleeSecurity(std::shared_ptr< RemoteEnrolleeResource > remoteEnrolleeResource,
\r
47 std::string secDbPath);
\r
49 ESResult registerCallbackHandler(EnrolleeSecStatusCb enrolleeSecStatusCb,
\r
50 SecurityPinCb securityPinCb, SecProvisioningDbPathCb secProvisioningDbPathCb);
\r
52 EasySetupState performOwnershipTransfer();
\r
54 ESResult provisionCreds();
\r
56 ESResult provisionAcl();
\r
59 std::shared_ptr< RemoteEnrolleeResource > m_remoteEnrolleeResource;
\r
60 EnrolleeSecStatusCb m_enrolleeSecStatusCb;
\r
61 SecurityPinCb m_securityPinCb;
\r
62 SecProvisioningDbPathCb m_secProvisioningDbPathCb;
\r
63 std::shared_ptr< OC::OCSecureResource > m_unownedDevice;
\r
65 EnrolleeSecState m_enrolleeSecState;std::shared_ptr< OC::OCSecureResource > m_securedResource;
\r
67 std::shared_ptr< OC::OCSecureResource > findEnrollee(std::string host,
\r
68 OC::DeviceList_t &list);
\r
69 void provisionCb(OC::PMResultList_t *result, int hasError);
\r
70 void ownershipTransferCb(OC::PMResultList_t *result, int hasError);
\r
71 void convertUUIDToString(OicUuid_t uuid, std::string& uuidString);
\r
72 ESResult createProvisiongResourceACL(OicSecAcl_t *acl);
\r
73 int CalculateAclPermission(const char *temp_pms, uint16_t *pms);
\r
78 #endif /* ENROLLEE_SECURITY_H_*/
\r