Imported Upstream version 1.0.0
[platform/upstream/iotivity.git] / resource / csdk / security / provisioning / README.txt
1 Quick guide : How to make provisioning tool and servers. 
2
3 1. Provisioning Tool.
4
5   1-1. Callback function registration
6        Register the callback functions of ownership transfer method(OxM) using OTMSetOwnershipTransferCallbackData API.
7        You can use default OxM callback implementation located in resource/csdk/security/provisioning/include/oxm.
8
9        [Sample code for just-works OxM]
10            OTMCallbackData_t justWorksCBData = {};
11            justWorksCBData.loadSecretCB = LoadSecretJustWorksCallback;
12            justWorksCBData.createSecureSessionCB = CreateSecureSessionJustWorksCallback;
13            justWorksCBData.createSelectOxmPayloadCB = CreateJustWorksSelectOxmPayload;
14            justWorksCBData.createOwnerTransferPayloadCB = CreateJustWorksOwnerTransferPayload;
15            OTMSetOwnershipTransferCallbackData(OIC_JUST_WORKS, &justWorksCBData);
16
17   1-2. Find un-owned devices using OCDiscoverUnownedDevices API.
18        OCDiscoverUnownedDevices will fill the unowned device list in second parameter.
19
20        [Sample code for unowned device discovery]
21           OCProvisionDev_t* pDeviceList = NULL;
22           OCStackResult res = OCDiscoverUnownedDevices(PREDEFINED_TIMEOUT, &pDeviceList);
23           if(OC_STACK_OK != res)
24           {
25               //error
26           }
27
28        NOTE : We also provide OCDiscoverOwnedDevices API to find owned devices.
29
30   1-3. Performing ownership transfer
31      We provided OCDoOwnershipTransfer API to perform ownership transfer.
32      In order to perform ownership transfer, unowned device list is required generated by OCDiscoverUnownedDevices API.
33      OCDoOwnershipTransfer will require the result callback as 3rd paramter.
34      This callback function will be invoked when ownership transfer is finished.
35      You can check result of ownership transfer for each devices as array of OCProvisionResult_t.
36
37   1-4. Find owned devices using OCDiscoverOwendDevices API.
38   1-5. Provision credential between two owned devices.
39      If you have owned devices,
40      You can send a credential to  two owned devices using OCProvisionPairwiseDevices.
41      You can also send ACL in this process.
42
43   1-6. Free memory.
44      We provide ODDeleteDiscoverdDevices API to free list of OCProvisionDev_t.
45      Please delete your device list before the exit your application.
46
47
48 2. Server.
49  The samples are resource/csdk/security/provisioning/sample
50    2-1. Just-works OxM.
51        If you use just-works OxM to server.
52        You don't need any modification for your server.
53