/**
* Initialize credential resource by loading data from persistent storage.
*
- * @return ::OC_STACK_OK, if initialization is successful, else ::OC_STACK_ERROR if
- * initialization fails.
+ * @retval
+ * OC_STACK_OK - no errors
+ * OC_STACK_ERROR - stack process error
*/
OCStackResult InitCredResource();
/**
* Perform cleanup for credential resources.
*
- * @return ::OC_STACK_OK, if no errors. ::OC_STACK_ERROR, if stack process error.
- * ::OC_STACK_NO_RESOURCE, if resource not found.
- * ::OC_STACK_INVALID_PARAM, if invalid param.
+ * @retval
+ * OC_STACK_OK - no errors
+ * OC_STACK_ERROR - stack process error
+ * OC_STACK_NO_RESOURCE - resource not found
+ * OC_STACK_INVALID_PARAM - invalid param
*/
OCStackResult DeInitCredResource();
/**
- * This method is used by tinydtls/SRM to retrieve credential for given subject.
+ * This method is used by tinydtls/SRM to retrieve credential for given Subject.
*
- * @param subjectId for which credential is required.
+ * @param subject - subject for which credential is required.
*
- * @return reference to @ref OicSecCred_t, if credential is found, else NULL, if credential
- * not found.
+ * @retval
+ * reference to OicSecCred_t - if credential is found
+ * NULL - if credential not found
*/
const OicSecCred_t* GetCredResourceData(const OicUuid_t* subjectId);
/**
- * This function converts credential data into CBOR format.
- * Caller needs to invoke 'free' when done using returned string.
- *
- * @param cred is the pointer to instance of OicSecCred_t structure.
- * @param cborPayload is the CBOR converted value.
- * @param cborSize is the size of the CBOR.
- *
- * @return ::OC_STACK_OK if conversion is successful, else ::OC_STACK_ERROR if unsuccessful.
+ * This function converts credential data into JSON format.
+ * Caller needs to invoke 'free' when done using
+ * returned string.
+ * @param cred pointer to instance of OicSecCred_t structure.
+ *
+ * @retval
+ * pointer to JSON credential representation - if credential for subjectId found
+ * NULL - if credential for subjectId not found
*/
-OCStackResult CredToCBORPayload(const OicSecCred_t* cred, uint8_t **cborPayload,
- size_t *cborSize);
+char* BinToCredJSON(const OicSecCred_t* cred);
/**
* This function generates the bin credential data.
* @param ownersLen length of owners array
* @param owners array of owners.
*
- * @return pointer to instance of @ref OicSecCred_t if successful. else NULL in case of error.
-
+ * @retval
+ * pointer to instance of OicSecCred_t - success
+ * NULL - error
*/
OicSecCred_t * GenerateCredential(const OicUuid_t* subject, OicSecCredType_t credType,
- const uint8_t * publicData, const uint8_t * privateData,
- size_t ownersLen, const OicUuid_t * owners);
+ const char * publicData, const char * privateData, size_t ownersLen,
+ const OicUuid_t * owners);
/**
* This function adds the new cred to the credential list.
*
- * @param cred is the pointer to new credential.
+ * @param cred pointer to new credential.
*
- * @return ::OC_STACK_OK, cred not NULL and persistent storage gets updated.
- * ::OC_STACK_ERROR, cred is NULL or fails to update persistent storage.
+ * @retval
+ * OC_STACK_OK - cred not NULL and persistent storage gets updated
+ * OC_STACK_ERROR - cred is NULL or fails to update persistent storage
*/
OCStackResult AddCredential(OicSecCred_t * cred);
/**
* Function to remove the credential from SVR DB.
*
- * @param credId is the Credential ID to be deleted.
+ * @param credId Credential ID to be deleted.
*
- * @return ::OC_STACK_OK for success, or errorcode otherwise.
+ * @return OC_STACK_OK for success and errorcode otherwise.
*/
-OCStackResult RemoveCredential(const OicUuid_t *credId);
+OCStackResult RemoveCredential(const OicUuid_t* credId);
+
+/**
+ * Remove all credential data on credential resource and persistent storage
+ *
+ * @retval
+ * OC_STACK_OK - no errors
+ * OC_STACK_ERROR - stack process error
+ */
+OCStackResult RemoveAllCredentials(void);
#if defined(__WITH_DTLS__)
/**
* This internal callback is used by lower stack (i.e. CA layer) to
* retrieve PSK credentials from RI security layer.
*
- * @param type of PSK data required by CA layer during DTLS handshake.
- * @param desc Additional request information.
- * @param desc_len is the actual length of desc.
- * @param result is must be filled with the requested information.
- * @param result_length is the maximum size of @p result.
+ * @param[in] type type of PSK data required by CA layer during DTLS handshake.
+ * @param[in] desc Additional request information.
+ * @param[in] desc_len The actual length of desc.
+ * @param[out] result Must be filled with the requested information.
+ * @param[in] result_length Maximum size of @p result.
*
* @return The number of bytes written to @p result or a value
* less than zero on error.
unsigned char *result, size_t result_length);
/**
- * Add temporal PSK to PIN based OxM.
+ * Add temporal PSK to PIN based OxM
*
- * @param tmpSubject is the UUID of target device
- * @param credType is the type of credential to be added
- * @param pin is the numeric characters
- * @param pinSize is the length of 'pin'
- * @param ownersLen is the number of owners
- * @param owners is the array of owners
- * @param tmpCredSubject is the generated credential's subject.
+ * @param[in] tmpSubject UUID of target device
+ * @param[in] credType Type of credential to be added
+ * @param[in] pin numeric characters
+ * @param[in] pinSize length of 'pin'
+ * @param[in] ownersLen Number of owners
+ * @param[in] owners Array of owners
+ * @param[out] tmpCredSubject Generated credential's subject.
*
- * @return ::OC_STACK_OK for success or else errorcode.
+ * @return OC_STACK_OK for success and errorcode otherwise.
*/
OCStackResult AddTmpPskWithPIN(const OicUuid_t* tmpSubject, OicSecCredType_t credType,
const char * pin, size_t pinSize,
- size_t ownersLen, const OicUuid_t * owners,
- OicUuid_t* tmpCredSubject);
+ size_t ownersLen, const OicUuid_t * owners, OicUuid_t* tmpCredSubject);
#endif /* __WITH_DTLS__ */
/**
* This function is used toretrieve certificate credentials from RI security layer.
*
- * @param credInfo is the binary structure containing certificate credentials
+ * @param credInfo
+ * binary structure containing certificate credentials
*
- * @return 0 on success.
+ * @retval 0 on scuccess
*/
int GetDtlsX509Credentials(CADtlsX509Creds_t *credInfo);
#endif /*__WITH_X509__*/
/**
- * Function to deallocate allocated memory to OicSecCred_t.
+ * Function to deallocate allocated memory to OicSecCred_t
*
- * @param cred pointer to cred type.
+ * @param cred pointer to cred type
*
*/
void DeleteCredList(OicSecCred_t* cred);
#endif
#endif //IOTVT_SRM_CREDR_H
+
+