1 /* *****************************************************************
3 * Copyright 2016 Samsung Electronics All Rights Reserved.
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
11 * http://www.apache.org/licenses/LICENSE-2.0
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.
19 * *****************************************************************/
21 #ifndef IOTVT_SRM_VER_H
22 #define IOTVT_SRM_VER_H
31 * Initialize VER resource by loading data from persistent storage.
33 * @return ::OC_STACK_OK for Success, otherwise some error value.
35 OCStackResult InitVerResource();
38 * Perform cleanup for VER resources.
40 * @return ::OC_STACK_OK for Success, otherwise some error value.
42 OCStackResult DeInitVerResource();
45 * This method is used by SRM to retrieve VER resource data..
47 * @return reference to @ref OicSecDoxm_t, binary format of Doxm resource data.
49 const OicSecVer_t* GetVerResourceData();
52 * This method converts CBOR VER into binary VER.
53 * The CBOR VER can be from persistent database or
54 * or received as PUT/POST request.
56 * @param cborPayload is a ver data in cbor.
57 * @note Caller needs to invoke OCFree after done using the return pointer.
58 * @param doxm is the pointer to @ref OicSecVer_t.
59 * @param size of the cborPayload. In case value is 0, CBOR_SIZE value is assigned.
61 * @return ::OC_STACK_OK for Success, otherwise some error value.
63 OCStackResult CBORPayloadToVer(const uint8_t *cborPayload, size_t size,
67 * This method converts VER data into CBOR format.
68 * Caller needs to invoke 'free' when finished done using
71 * @param ver Pointer to @ref OicSecVer_t.
72 * @note Caller needs to invoke OCFree after done using the return pointer.
73 * @param cborPayload is the payload of the cbor.
74 * @param cborSize is the size of the cbor payload. Passed parameter should not be NULL.
76 * @return ::OC_STACK_OK for Success, otherwise some error value.
78 OCStackResult VerToCBORPayload(const OicSecVer_t * ver, uint8_t **cborPayload,
82 * Get the security version.
84 * @return the version string of security.
86 const char* GetSecVersion();
88 /** This function deallocates the memory for OicSecVer_t .
90 * @param ver is the pointer to @ref OicSecVer_t.
92 void DeleteVerBinData(OicSecVer_t* ver);
98 #endif //IOTVT_SRM_VER_H