Update snapshot(2018-01-10)
[platform/upstream/iotivity.git] / resource / csdk / security / provisioning / include / ocprovisioningmanager.h
1 /* *****************************************************************
2  *
3  * Copyright 2015 Samsung Electronics All Rights Reserved.
4  *
5  *
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 #ifndef OCPROVISIONINGMANAGER_H_
22 #define OCPROVISIONINGMANAGER_H_
23
24 #include "octypes.h"
25 #include "pmtypes.h"
26 #include "casecurityinterface.h"
27 #include "ownershiptransfermanager.h"
28 #ifdef MULTIPLE_OWNER
29 #include "securevirtualresourcetypes.h"
30 #endif //MULTIPLE_OWNER
31
32 #ifdef __cplusplus
33 extern "C" {
34 #endif // __cplusplus
35
36 /**
37  * The function is responsible for initializaton of the provisioning manager. It will load
38  * provisioning database which have owned device's list and their linked status.
39  * TODO: In addition, if there is a device(s) which has not up-to-date credentials, this function will
40  * automatically try to update the deivce(s).
41  *
42  * @param[in] dbPath file path of the sqlite3 db
43  *
44  * @return OC_STACK_OK in case of success and other value otherwise.
45  */
46 OCStackResult OCInitPM(const char *dbPath);
47
48 /**
49  * API to termiante the provisioning manager
50  */
51 void OCTerminatePM();
52
53 /**
54  * API to cleanup PDM in case of timeout.
55  * It will remove the PDM_DEVICE_INIT state devices from PDM.
56  *
57  * @return OC_STACK_OK in case of success and other value otherwise.
58  */
59 OCStackResult OCPDMCleanupForTimeout();
60
61 /**
62  * The function is responsible for discovery of owned/unowned device is specified endpoint/deviceID.
63  * It will return the found device even though timeout is not exceeded.
64  *
65  * @param[in] timeout Timeout in seconds, value till which function will listen to responses from
66  *                    server before returning the device.
67  * @param[in] deviceID         deviceID of target device.
68  * @param[out] ppFoundDevice     OCProvisionDev_t of found device
69  * @return OTM_SUCCESS in case of success and other value otherwise.
70  */
71 OCStackResult OCDiscoverSingleDevice(unsigned short timeout, const OicUuid_t *deviceID,
72                                      OCProvisionDev_t **ppFoundDevice);
73
74 /**
75  * The function is responsible for discovery of owned/unowned device is specified endpoint/MAC
76  * address.
77  * It will return the found device even though timeout is not exceeded.
78  *
79  * @param[in] timeout Timeout in seconds, value till which function will listen to responses from
80  *                    server before returning the device.
81  * @param[in] deviceID         deviceID of target device.
82  * @param[in] hostAddress       MAC address of target device.
83  * @param[in] connType       ConnectivityType for discovery.
84  * @param[out] ppFoundDevice     OCProvisionDev_t of found device.
85  * @return OTM_SUCCESS in case of success and other value otherwise.
86  */
87 OCStackResult OCDiscoverSingleDeviceInUnicast(unsigned short timeout, const OicUuid_t *deviceID,
88         const char *hostAddress, OCConnectivityType connType,
89         OCProvisionDev_t **ppFoundDevice);
90
91 /**
92  * The function is responsible for discovery of device is current subnet. It will list
93  * all the device in subnet which are not yet owned. Please call OCInit with OC_CLIENT_SERVER as
94  * OCMode.
95  *
96  * @param[in] timeout Timeout in seconds, value till which function will listen to responses from
97  *                    server before returning the list of devices.
98  * @param[out] ppList List of candidate devices to be provisioned
99  * @return OTM_SUCCESS in case of success and other value otherwise.
100  */
101 OCStackResult OCDiscoverUnownedDevices(unsigned short waittime, OCProvisionDev_t **ppList);
102
103 /**
104  * Do ownership transfer for un-owned device.
105  *
106  * @param[in] ctx Application context would be returned in result callback
107  * @param[in] targetDevices List of devices to perform ownership transfer.
108  * @param[in] resultCallback Result callback function to be invoked when ownership transfer finished.
109  * @return OC_STACK_OK in case of success and other value otherwise.
110  */
111 OCStackResult OCDoOwnershipTransfer(void *ctx,
112                                     OCProvisionDev_t *targetDevices,
113                                     OCProvisionResultCB resultCallback);
114
115 /**
116  * API to set a allow status of OxM
117  *
118  * @param[in] oxm Owership transfer method (ref. OicSecOxm_t)
119  * @param[in] allowStatus allow status (true = allow, false = not allow)
120  *
121  * @return OC_STACK_OK in case of success and other value otherwise.
122  */
123 OCStackResult OCSetOxmAllowStatus(const OicSecOxm_t oxm, const bool allowStatus);
124
125
126 #ifdef MULTIPLE_OWNER
127 /**
128  * API to perfrom multiple ownership transfer for MOT enabled device.
129  *
130  * @param[in] ctx Application context would be returned in result callback
131  * @param[in] targetDevices List of devices to perform ownership transfer.
132  * @param[in] resultCallback Result callback function to be invoked when ownership transfer finished.
133  * @return OC_STACK_OK in case of success and other value otherwise.
134  */
135 OCStackResult OCDoMultipleOwnershipTransfer(void *ctx,
136         OCProvisionDev_t *targetDevices,
137         OCProvisionResultCB resultCallback);
138
139 /**
140  * API to remove sub-owner from resource server
141  *
142  * @param[in] ctx Application context would be returned in result callback
143  * @param[in] targetDeviceInfo Selected target device.
144  * @param[in] subOwner sub-owner UUID to be removed
145  * @param[in] resultCallback callback provided by API user, callback will be invoked when
146  *            DELETE 'subowneruuid' request recieves a response from resource server.
147  * @return OC_STACK_OK in case of success and other value otherwise.
148  */
149 OCStackResult OCRemoveSubOwner(void *ctx,
150                                const OCProvisionDev_t *targetDeviceInfo,
151                                const OicUuid_t *subOwner,
152                                OCProvisionResultCB resultCallback);
153
154 /**
155  * API to remove all sub-owner from resource server
156  *
157  * @param[in] ctx Application context would be returned in result callback
158  * @param[in] targetDeviceInfo Selected target device.
159  * @param[in] resultCallback callback provided by API user, callback will be invoked when
160  *            DELETE 'subowneruuid' request recieves a response from resource server.
161  * @return OC_STACK_OK in case of success and other value otherwise.
162  */
163 OCStackResult OCRemoveAllSubOwner(void *ctx,
164                                   const OCProvisionDev_t *targetDeviceInfo,
165                                   OCProvisionResultCB resultCallback);
166
167 #endif //MULTIPLE_OWNER
168
169 /**
170  * API to register for particular OxM.
171  *
172  * @param[in] Ownership transfer method.
173  * @param[in] Implementation of callback functions for owership transfer.
174  * @return OC_STACK_OK in case of success and other value otherwise.
175  */
176 OCStackResult OCSetOwnerTransferCallbackData(OicSecOxm_t oxm, OTMCallbackData_t *callbackData);
177
178 /**
179  * The function is responsible for discovery of owned device is current subnet. It will list
180  * all the device in subnet which are owned by calling provisioning client.
181  *
182  * @param[in] timeout Timeout in seconds, value till which function will listen to responses from
183  *                    server before returning the list of devices.
184  * @param[out] ppList List of device owned by provisioning tool.
185  * @return OTM_SUCCESS in case of success and other value otherwise.
186  */
187 OCStackResult OCDiscoverOwnedDevices(unsigned short timeout, OCProvisionDev_t **ppList);
188
189 #ifdef MULTIPLE_OWNER
190 /**
191  * The function is responsible for discovery of MOT enabled device is current subnet.
192  *
193  * @param[in] timeout Timeout in seconds, value till which function will listen to responses from
194  *                    server before returning the list of devices.
195  * @param[out] ppList List of MOT enabled devices.
196  * @return OC_STACK_OK in case of success and other value otherwise.
197  */
198 OCStackResult OCDiscoverMultipleOwnerEnabledDevices(unsigned short timeout,
199         OCProvisionDev_t **ppList);
200
201 /**
202  * The function is responsible for discovery of Multiple Owned device is current subnet.
203  *
204  * @param[in] timeout Timeout in seconds, value till which function will listen to responses from
205  *                    server before returning the list of devices.
206  * @param[out] ppList List of Multiple Owned devices.
207  * @return OC_STACK_OK in case of success and other value otherwise.
208  */
209 OCStackResult OCDiscoverMultipleOwnedDevices(unsigned short timeout, OCProvisionDev_t **ppList);
210 #endif //MULTIPLE_OWNER
211
212 /**
213  * API to provision credentials between two devices and ACLs for the devices who act as a server.
214  *
215  * @param[in] ctx Application context would be returned in result callback.
216  * @param[in] type Type of credentials to be provisioned to the device.
217  * @param[in] pDev1 Pointer to OCProvisionDev_t instance,respresenting device to be provisioned.
218  * @param[in] acl ACL for device 1. If this is not required set NULL.
219  * @param[in] pDev2 Pointer to OCProvisionDev_t instance,respresenting device to be provisioned.
220  * @param[in] acl ACL for device 2. If this is not required set NULL.
221  * @param[in] resultCallback callback provided by API user, callback will be called when
222  *            provisioning request recieves a response from first resource server.
223  * @return OC_STACK_OK in case of success and other value otherwise.
224  */
225 OCStackResult OCProvisionPairwiseDevices(void *ctx, OicSecCredType_t type, size_t keySize,
226         const OCProvisionDev_t *pDev1, OicSecAcl_t *pDev1Acl,
227         const OCProvisionDev_t *pDev2, OicSecAcl_t *pDev2Acl,
228         OCProvisionResultCB resultCallback);
229
230 /**
231  * API to send ACL information to device.
232  *
233  * @param[in] ctx Application context would be returned in result callback.
234  * @param[in] selectedDeviceInfo Selected target device.
235  * @param[in] acl ACL to provision.
236  * @param[in] resultCallback callback provided by API user, callback will be called when provisioning
237               request recieves a response from resource server.
238  * @return OC_STACK_OK in case of success and other value otherwise.
239  */
240 OCStackResult OCProvisionACL(void *ctx, const OCProvisionDev_t *selectedDeviceInfo,
241                              OicSecAcl_t *acl,
242                              OCProvisionResultCB resultCallback);
243
244 /**
245  * function to save ACL which has several ACE into Acl of SVR.
246  *
247  * @param acl ACL to be saved in Acl of SVR.
248  * @return  OC_STACK_OK in case of success and other value otherwise.
249  */
250 OCStackResult OCSaveACL(const OicSecAcl_t *acl);
251
252 /**
253  * this function requests CRED information to resource.
254  *
255  * @param[in] ctx Application context would be returned in result callback.
256  * @param[in] selectedDeviceInfo Selected target device.
257  * @param[in] resultCallback callback provided by API user, callback will be called when provisioning
258               request recieves a response from resource server.
259  * @return  OC_STACK_OK in case of success and other value otherwise.
260  */
261 OCStackResult OCGetCredResource(void *ctx, const OCProvisionDev_t *selectedDeviceInfo,
262                                 OCProvisionResultCB resultCallback);
263
264 /**
265  * this function requests ACL information to resource.
266  *
267  * @param[in] ctx Application context would be returned in result callback.
268  * @param[in] selectedDeviceInfo Selected target device.
269  * @param[in] resultCallback callback provided by API user, callback will be called when provisioning
270               request recieves a response from resource server.
271  * @return  OC_STACK_OK in case of success and other value otherwise.
272  */
273 OCStackResult OCGetACLResource(void *ctx, const OCProvisionDev_t *selectedDeviceInfo,
274                                OCProvisionResultCB resultCallback);
275
276 /**
277  * this function sends Direct-Pairing Configuration to a device.
278  *
279  * @param[in] ctx Application context would be returned in result callback.
280  * @param[in] selectedDeviceInfo Selected target device.
281  * @param[in] pconf PCONF pointer.
282  * @param[in] resultCallback callback provided by API user, callback will be called when provisioning
283               request recieves a response from resource server.
284  * @return  OC_STACK_OK in case of success and other value otherwise.
285  */
286 OCStackResult OCProvisionDirectPairing(void *ctx, const OCProvisionDev_t *selectedDeviceInfo,
287                                        OicSecPconf_t *pconf,
288                                        OCProvisionResultCB resultCallback);
289
290 /**
291  * API to provision credential to devices.
292  *
293  * @param[in] ctx Application context would be returned in result callback.
294  * @param[in] type Type of credentials to be provisioned to the device.
295  * @param[in] pDev1 Pointer to OCProvisionDev_t instance,respresenting resource to be provsioned.
296    @param[in] pDev2 Pointer to OCProvisionDev_t instance,respresenting resource to be provsioned.
297  * @param[in] resultCallback callback provided by API user, callback will be called when
298  *            provisioning request recieves a response from first resource server.
299  * @return OC_STACK_OK in case of success and other value otherwise.
300  */
301 OCStackResult OCProvisionCredentials(void *ctx, OicSecCredType_t type, size_t keySize,
302                                      const OCProvisionDev_t *pDev1,
303                                      const OCProvisionDev_t *pDev2,
304                                      OCProvisionResultCB resultCallback);
305
306 #ifdef MULTIPLE_OWNER
307 /**
308  * API to provision preconfigured PIN to device(NOT LIST).
309  * If device does not support the Preconfigured PIN OxM,
310  * OCProvisionPreconfigPin API will update the device's Doxm
311  * and then try preconfigured PIN provisioning once again.
312  *
313  * @param[in] ctx Application context would be returned in result callback.
314  * @param[in] targetDeviceInfo Selected target device.
315  * @param[in] preconfigPin string of preconfigured PIN.
316  * @param[in] preconfigPinLen string length of 'preconfigPin'.
317  * @param[in] resultCallback callback provided by API user, callback will be called when
318  *            provisioning request recieves a response from first resource server.
319  * @return OC_STACK_OK in case of success and other value otherwise.
320  */
321 OCStackResult OCProvisionPreconfigPin(void *ctx,
322                                       OCProvisionDev_t *targetDeviceInfo,
323                                       const char *preconfigPin,
324                                       size_t preconfigPinLen,
325                                       OCProvisionResultCB resultCallback);
326
327 /**
328  * API to add preconfigured PIN to local SVR DB.
329  *
330  * @param[in] targetDeviceInfo Selected target device.
331  * @param[in] preconfigPin Preconfig PIN which is used while multiple owner authentication
332  * @param[in] preconfigPinLen Byte length of preconfigPin
333  * @return OC_STACK_OK in case of success and other value otherwise.
334  */
335 OCStackResult OCAddPreconfigPin(const OCProvisionDev_t *targetDeviceInfo,
336                                 const char *preconfigPin,
337                                 size_t preconfigPinLen);
338
339 /**
340  * API to update 'doxm.mom' to resource server.
341  *
342  * @param[in] targetDeviceInfo Selected target device.
343  * @param[in] momType Mode of multiple ownership transfer (ref. oic.sec.mom)
344  * @param[in] resultCallback callback provided by API user, callback will be called when
345  *            POST 'mom' request recieves a response from resource server.
346  * @return OC_STACK_OK in case of success and other value otherwise.
347  */
348 OCStackResult OCChangeMOTMode(void *ctx, const OCProvisionDev_t *targetDeviceInfo,
349                               const OicSecMomType_t momType, OCProvisionResultCB resultCallback);
350
351 /**
352  * API to update 'doxm.oxmsel' to resource server.
353  *
354  * @param[in] targetDeviceInfo Selected target device.
355  * @param[in] oxmSelValue Method of multiple ownership transfer (ref. oic.sec.oxm)
356  * @param[in] resultCallback callback provided by API user, callback will be called when
357  *            POST 'oxmsel' request recieves a response from resource server.
358  * @return OC_STACK_OK in case of success and other value otherwise.
359  */
360 OCStackResult OCSelectMOTMethod(void *ctx, const OCProvisionDev_t *targetDeviceInfo,
361                                 const OicSecOxm_t oxmSelValue, OCProvisionResultCB resultCallback);
362 #endif //MULTIPLE_OWNER
363
364 /**
365  * Function to unlink devices.
366  * This function will remove the credential & relasionship between the two devices.
367  *
368  * @param[in] ctx Application context would be returned in result callback
369  * @param[in] pTargetDev1 fitst device information to be unlinked.
370  * @param[in] pTargetDev2 second device information to be unlinked.
371  * @param[in] resultCallback callback provided by API user, callback will be called when
372  *            device unlink is finished.
373  * @return OC_STACK_OK in case of success and other value otherwise.
374  */
375 OCStackResult OCUnlinkDevices(void *ctx,
376                               const OCProvisionDev_t *pTargetDev1,
377                               const OCProvisionDev_t *pTargetDev2,
378                               OCProvisionResultCB resultCallback);
379
380 /**
381  * Function for device revocation
382  * This function will remove credential of target device from all devices in subnet.
383  *
384  * @param[in] ctx Application context would be returned in result callback
385  * @param[in] waitTimeForOwnedDeviceDiscovery Maximum wait time for owned device discovery.(seconds)
386  * @param[in] pTargetDev Device information to be revoked.
387  * @param[in] resultCallback callback provided by API user, callback will be called when
388  *            credential revocation is finished.
389  * @return OC_STACK_OK in case of success and other value otherwise.
390  *         if OC_STACK_OK is returned, the caller of this API should wait for callback.
391  *         OC_STACK_CONTINUE means operation is success but no need to wait for callback.
392  */
393 OCStackResult OCRemoveDevice(void *ctx,
394                              unsigned short waitTimeForOwnedDeviceDiscovery,
395                              const OCProvisionDev_t *pTargetDev,
396                              OCProvisionResultCB resultCallback);
397
398 /*
399 * Function to device revocation
400 * This function will remove credential of target device from all devices in subnet.
401 *
402 * @param[in] ctx Application context would be returned in result callback
403 * @param[in] waitTimeForOwnedDeviceDiscovery Maximum wait time for owned device discovery.(seconds)
404 * @param[in] pTargetDev Device information to be revoked.
405 * @param[in] resultCallback callback provided by API user, callback will be called when
406 *            credential revocation is finished.
407  * @return  OC_STACK_OK in case of success and other value otherwise.
408 */
409 OCStackResult OCRemoveDeviceWithUuid(void *ctx,
410                                      unsigned short waitTimeForOwnedDeviceDiscovery,
411                                      const OicUuid_t *pTargetUuid,
412                                      OCProvisionResultCB resultCallback);
413
414 /*
415  * Function to reset the target device.
416  * This function will remove credential and ACL of target device from all devices in subnet.
417  *
418  * @param[in] ctx Application context would be returned in result callback
419  * @param[in] waitTimeForOwnedDeviceDiscovery Maximum wait time for owned device discovery.(seconds)
420  * @param[in] pTargetDev Device information to be revoked.
421  * @param[in] resultCallback callback provided by API user, callback will be called when
422  *            credential revocation is finished.
423  * @return  OC_STACK_OK in case of success and other value otherwise.
424  */
425 OCStackResult OCResetDevice(void *ctx, unsigned short waitTimeForOwnedDeviceDiscovery,
426                             const OCProvisionDev_t *pTargetDev,
427                             OCProvisionResultCB resultCallback,
428                             OCClientContextDeleter deleteCallback);
429
430 /**
431  * This function resets SVR DB to its factory setting.
432  *
433  *@return OC_STACK_OK in case of successful reset and other value otherwise.
434  */
435 OCStackResult OCResetSVRDB(void);
436
437 /**
438  * This function configures SVR DB as self-ownership.
439  *
440  *@return OC_STACK_OK in case of successful configue and other value otherwise.
441  */
442 OCStackResult OCConfigSelfOwnership(void);
443
444 /**
445  * API to get status of all the devices in current subnet. The status include endpoint information
446  * and doxm information which can be extracted duing owned and unowned discovery. Along with this
447  * information. The API will provide information about devices' status
448  * Device can have following states
449  *  - ON/OFF: Device is switched on or off.
450  *
451  * NOTE: Caller need to call OCDeleteDiscoveredDevices to delete memory allocated by this API for out
452  * variables pOwnedDevList and pUnownedDevList.
453  *
454  * @param[in] waitime Wait time for the API. The wait time will be divided by 2, and half of wait time
455  * will be used for unowned discovery and remaining half for owned discovery. So the wait time should be
456  * equal to or more than 2.
457  * @param[out] pOwnedDevList  list of owned devices.
458  * @param[out] pUnownedDevList  list of unowned devices.
459  * @return OC_STACK_OK in case of success and other value otherwise.
460  */
461 OCStackResult OCGetDevInfoFromNetwork(unsigned short waittime,
462                                       OCProvisionDev_t **pOwnedDevList,
463                                       OCProvisionDev_t **pUnownedDevList);
464 /**
465  * This method is used to get linked devices' IDs.
466  *
467  * @param[in] uuidOfDevice a target device's uuid.
468  * @param[out] uuidList information about the list of linked devices' uuids.
469  * @param[out] numOfDevices total number of linked devices.
470  * @return OC_STACK_OK in case of success and other value otherwise.
471  */
472 OCStackResult OCGetLinkedStatus(const OicUuid_t *uuidOfDevice,
473                                 OCUuidList_t **uuidList,
474                                 size_t *numOfDevices);
475
476 /**
477  * API to delete memory allocated to linked list created by OCDiscover_XXX_Devices API.
478  *
479  * @param[in] pList Pointer to OCProvisionDev_t which should be deleted.
480  */
481 void OCDeleteDiscoveredDevices(OCProvisionDev_t *pList);
482
483 /**
484  * API to delete memory allocated to OicUuid_t list.
485  *
486  * @param[in] pList Pointer to OicUuid_t list which should be deleted.
487  */
488 void OCDeleteUuidList(OCUuidList_t *pList);
489
490 /**
491  * This function deletes ACL data.
492  *
493  * @param pAcl Pointer to OicSecAcl_t structure.
494  */
495 void OCDeleteACLList(OicSecAcl_t *pAcl);
496
497 /**
498  * This function deletes PDACL data.
499  *
500  * @param pPdAcl Pointer to OicSecPdAcl_t structure.
501  */
502 void OCDeletePdAclList(OicSecPdAcl_t *pPdAcl);
503
504 #if defined(__WITH_DTLS__) || defined(__WITH_TLS__)
505 /**
506  * function to provision Trust certificate chain to devices.
507  *
508  * @param[in] ctx Application context would be returned in result callback.
509  * @param[in] type Type of credentials to be provisioned to the device.
510  * @param[in] credId CredId of trust certificate chain to be provisioned to the device.
511  * @param[in] selectedDeviceInfo Pointer to OCProvisionDev_t instance,respresenting resource to be provsioned.
512  * @param[in] resultCallback callback provided by API user, callback will be called when
513  *            provisioning request recieves a response from first resource server.
514  * @return  OC_STACK_OK in case of success and other value otherwise.
515  */
516 OCStackResult OCProvisionTrustCertChain(void *ctx, OicSecCredType_t type, uint16_t credId,
517                                         const OCProvisionDev_t *selectedDeviceInfo,
518                                         OCProvisionResultCB resultCallback);
519 /**
520  * function to save Trust certificate chain into Cred of SVR.
521  *
522  * @param[in] trustCertChain Trust certificate chain to be saved in Cred of SVR.
523  * @param[in] chainSize Size of trust certificate chain to be saved in Cred of SVR
524  * @param[in] encodingType Encoding type of trust certificate chain to be saved in Cred of SVR
525  * @param[out] credId CredId of saved trust certificate chain in Cred of SVR.
526  * @return  OC_STACK_OK in case of success and other value otherwise.
527  */
528 OCStackResult OCSaveTrustCertChain(uint8_t *trustCertChain, size_t chainSize,
529                                    OicEncodingType_t encodingType, uint16_t *credId);
530 /**
531  * function to register callback, for getting notification for TrustCertChain change.
532  *
533  * @param[in] TrustCertChainChangeCB notifier callback function
534  * @return OC_STACK_OK in case of success and other value otherwise.
535  */
536 OCStackResult OCRegisterTrustCertChainNotifier(void *cb, TrustCertChainChangeCB CB);
537
538 /**
539  * function to de-register TrustCertChain notification callback.
540  */
541 void OCRemoveTrustCertChainNotifier(void);
542
543 /*
544  * Function to read Trust certificate chain from SVR.
545  * Caller must free when done using the returned trust certificate
546  * @param[in] credId CredId of trust certificate chain in SVR.
547  * @param[out] trustCertChain Trust certificate chain.
548  * @param[out] chainSize Size of trust certificate chain
549  * @return  OC_STACK_OK in case of success and other value otherwise.
550  */
551 OCStackResult OCReadTrustCertChain(uint16_t credId, uint8_t **trustCertChain,
552                                    size_t *chainSize);
553
554 /**
555  * Function to select appropriate security provisioning method.
556  *
557  * @param[in] supportedMethods   Array of supported methods
558  * @param[in] numberOfMethods   number of supported methods
559  * @param[out]  selectedMethod         Selected methods
560  * @param[in] ownerType type of owner device (SUPER_OWNER or SUB_OWNER)
561  * @return  OC_STACK_OK on success
562  */
563 OCStackResult OCSelectOwnershipTransferMethod(const OicSecOxm_t *supportedMethods,
564         size_t numberOfMethods, OicSecOxm_t *selectedMethod, OwnerType_t ownerType);
565
566 /**
567  * This function sets the callback to utilize peer certificate information
568  */
569 OCStackResult OCSetPeerCertCallback(void *ctx, PeerCertCallback peerCertCallback);
570
571 #endif // __WITH_DTLS__ || __WITH_TLS__
572
573
574 #ifdef __cplusplus
575 }
576 #endif // __cplusplus
577
578 #endif /* OCPROVISIONINGMANAGER_H_ */