1 //******************************************************************
3 // Copyright 2015 Samsung Electronics All Rights Reserved.
5 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
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_CRLR_H
22 #define IOTVT_SRM_CRLR_H
25 #include "securevirtualresourcetypes.h"
32 * This function stores CRL in SRM
35 * @returns OC_STACK_OK for Success, otherwise some error value
37 OCStackResult UpdateCRLResource(const OicSecCrl_t *crl);
40 * This function get encoded with base64 CRL from SRM
42 * @returns encoded CRL with base64 format. NULL if error occured (e.g. CRL did not set)
43 * @note Caller responsible for resulting string memory (use OICFree to remove it)
47 * This function get encoded with DER CRL from SRM
49 * @returns encoded CRL with DER format. array len is 0 if error occured (e.g. CRL did not set)
51 void GetDerCrl(ByteArray crlArray);
54 * This function get CRL from SRM
56 * @param crl [out] - pointer to buffer that contains crl. Shoul be not NULL. Buffer
57 * will be allocated by the function and content of *crl will be ignored.
58 * @param outlen [out] - pointer to length of the CRL buffer. Shoul be not NULL.
60 * @returns OC_STACK_OK if success and errorcode otherwise.
61 * @note Caller responsible for crl buffer memory (use OICFree to free it)
63 OicSecCrl_t * JSONToCrlBin(const char * jsonStr);
66 * Initialize CLR resource by loading data from persistent storage.
68 * @returns OC_STACK_OK for Success, otherwise some error value
70 OCStackResult InitCRLResource();
73 * Perform cleanup for CRL resources.
75 void DeInitCRLResource();
77 OicSecCrl_t *GetCRLResource();
79 OCEntityHandlerResult CRLEntityHandler(OCEntityHandlerFlag flag,
80 OCEntityHandlerRequest * ehRequest,
81 void* callbackParameter);
86 #endif //IOTVT_SRM_CRLR_H