X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=resource%2Fcsdk%2Fsecurity%2Fprovisioning%2Finclude%2Finternal%2Fsecureresourceprovider.h;h=a66f546263ef398f3e06dfd90376f4208a44202c;hb=c315c87e07c4080ecd0ef488e7a1047bc3c509b2;hp=5fbc284ad1a7fbdb08fdbdb2084eccf5eab61214;hpb=7b017138673175a8a5891b242efca8ed44227349;p=platform%2Fupstream%2Fiotivity.git diff --git a/resource/csdk/security/provisioning/include/internal/secureresourceprovider.h b/resource/csdk/security/provisioning/include/internal/secureresourceprovider.h index 5fbc284..a66f546 100644 --- a/resource/csdk/security/provisioning/include/internal/secureresourceprovider.h +++ b/resource/csdk/security/provisioning/include/internal/secureresourceprovider.h @@ -24,6 +24,8 @@ #include "ocstack.h" #include "securevirtualresourcetypes.h" #include "pmtypes.h" +#include "octypes.h" + #ifdef __cplusplus extern "C" @@ -43,6 +45,14 @@ OCStackResult SRPProvisionACL(void *ctx, const OCProvisionDev_t *selectedDeviceI OicSecAcl_t *acl, OCProvisionResultCB resultCallback); /** + * API to save ACL which has several ACE into Acl of SVR. + * + * @param acl ACL to be saved in Acl of SVR. + * @return OC_STACK_OK in case of success and other value otherwise. + */ +OCStackResult SRPSaveACL(const OicSecAcl_t *acl); + +/** * API to request CRED information to resource. * * @param[in] selectedDeviceInfo Selected target device. @@ -64,19 +74,60 @@ OCStackResult SRPGetCredResource(void *ctx, const OCProvisionDev_t *selectedDevi OCStackResult SRPGetACLResource(void *ctx, const OCProvisionDev_t *selectedDeviceInfo, OCProvisionResultCB resultCallback); -#ifdef __WITH_X509__ +#if defined(__WITH_DTLS__) || defined(__WITH_TLS__) + /** - * API to send CRL information to resource. + * function to provision Trust certificate chain to devices. * - * @param[in] selectedDeviceInfo Selected target device. - * @param[in] crl CRL to provision. + * @param[in] ctx Application context would be returned in result callback. + * @param[in] type Type of credentials to be provisioned to the device. + * @param[in] credId CredId of trust certificate chain to be provisioned to the device. + * @param[in] selectedDeviceInfo Pointer to OCProvisionDev_t instance,respresenting resource to be provsioned. * @param[in] resultCallback callback provided by API user, callback will be called when - * provisioning request recieves a response from resource server. + * provisioning request recieves a response from first resource server. + * @return OC_STACK_OK in case of success and other value otherwise. + */ +OCStackResult SRPProvisionTrustCertChain(void *ctx, OicSecCredType_t type, uint16_t credId, + const OCProvisionDev_t *selectedDeviceInfo, + OCProvisionResultCB resultCallback); + +/** + * function to save Trust certificate chain into Cred of SVR. + * + * @param[in] trustCertChain Trust certificate chain to be saved in Cred of SVR. + * @param[in] chainSize Size of trust certificate chain to be saved in Cred of SVR + * @param[in] encodingType Encoding type of trust certificate chain to be saved in Cred of SVR + * @param[out] credId CredId of saved trust certificate chain in Cred of SVR. + * @return OC_STACK_OK in case of success and other value otherwise. + */ +OCStackResult SRPSaveTrustCertChain(uint8_t *trustCertChain, size_t chainSize, + OicEncodingType_t encodingType,uint16_t *credId); + +/** + * function to save own certificate chain into Cred of SVR. + * + * @param[in] cert own certificate chain to be saved in Cred of SVR. + * @param[in] key own secret key to be saved in Cred of SVR. + * @param[out] credId CredId of saved trust certificate chain in Cred of SVR. + * @return OC_STACK_OK in case of success and other value otherwise. + */ +OCStackResult SRPSaveOwnCertChain(OicSecKey_t * cert, OicSecKey_t * key, uint16_t *credId); + +/** + * function to register callback, for getting notification for TrustCertChain change. + * + * @param[in] ctx user context to be passed. + * @param[in] TrustCertChainChangeCB notifier callback function * @return OC_STACK_OK in case of success and other value otherwise. */ -OCStackResult SRPProvisionCRL(void *ctx, const OCProvisionDev_t *selectedDeviceInfo, - OicSecCrl_t *crl, OCProvisionResultCB resultCallback); -#endif // __WITH_X509__ +OCStackResult SRPRegisterTrustCertChainNotifier(void *ctx, TrustCertChainChangeCB callback); + +/** + * function to de-register TrustCertChain notification callback. + */ +void SRPRemoveTrustCertChainNotifier(void); + +#endif // __WITH_DTLS__ || __WITH_TLS__ /** * API to send Direct-Pairing Configuration to a device. * @@ -153,6 +204,22 @@ OCStackResult SRPRemoveDevice(void* ctx, OCProvisionResultCB resultCallback); /* +* Function to device revocation +* This function will remove credential of target device from all devices in subnet. +* +* @param[in] ctx Application context would be returned in result callback +* @param[in] pOwnedDevList List of owned devices +* @param[in] pTargetDev Device information to be revoked. +* @param[in] resultCallback callback provided by API user, callback will be called when +* credential revocation is finished. +* @return OC_STACK_OK in case of success and other value otherwise. +* If OC_STACK_OK is returned, the caller of this API should wait for callback. +* OC_STACK_CONTINUE means operation is success but no request is need to be initiated. +*/ +OCStackResult SRPRemoveDeviceWithoutDiscovery(void* ctx, const OCProvisionDev_t* pOwnedDevList, + const OCProvisionDev_t* pTargetDev, OCProvisionResultCB resultCallback); + +/* * Function to sync-up credential and ACL of the target device. * This function will remove credential and ACL of target device from all devices in subnet. * @@ -185,6 +252,16 @@ OCStackResult SRPSyncDevice(void* ctx, unsigned short waitTimeForOwnedDeviceDisc OCStackResult SRPResetDevice(const OCProvisionDev_t* pTargetDev, OCProvisionResultCB resultCallback); +/* + * Function to read Trust certificate chain from SVR. + * Caller must free when done using the returned trust certificate + * @param[in] credId CredId of trust certificate chain in SVR. + * @param[out] trustCertChain Trust certificate chain. + * @param[out] chainSize Size of trust certificate chain + * @return OC_STACK_OK in case of success and other value otherwise. + */ +OCStackResult SRPReadTrustCertChain(uint16_t credId, uint8_t **trustCertChain, + size_t *chainSize); #ifdef __cplusplus } #endif