tizen 2.3 release
[framework/web/wearable/wrt-security.git] / wrt_ocsp / include / wrt_ocsp_api.h
1 /*
2  *    Copyright (c) 2012 Samsung Electronics Co., Ltd All Rights Reserved
3  *
4  *    Licensed under the Apache License, Version 2.0 (the "License");
5  *    you may not use this file except in compliance with the License.
6  *    You may obtain a copy of the License at
7  *
8  *        http://www.apache.org/licenses/LICENSE-2.0
9  *
10  *    Unless required by applicable law or agreed to in writing, software
11  *    distributed under the License is distributed on an "AS IS" BASIS,
12  *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  *    See the License for the specific language governing permissions and
14  *    limitations under the License.
15  */
16 /*
17  * @file        wrt_oscp_api.h
18  * @author      Zofia Abramowska (z.abramowska@samsung.com)
19  * @version     1.0
20  * @brief       This is C api for WRT OCSP
21  */
22 #ifndef WRT_OCSP_API_H
23 #define WRT_OCSP_API_H
24
25 #ifdef __cplusplus
26 extern "C" {
27 #endif
28
29 typedef enum{
30   WRT_OCSP_OK,
31   WRT_OCSP_INVALID_ARGUMENTS,
32   WRT_OCSP_INTERNAL_ERROR
33 }wrt_ocsp_return_t;
34
35 typedef int wrt_ocsp_widget_handle_t;
36 typedef enum {
37   //The certificate has not been revoked.
38   WRT_OCSP_WIDGET_VERIFICATION_STATUS_GOOD,
39
40   //The certificate has been revoked.
41   WRT_OCSP_WIDGET_VERIFICATION_STATUS_REVOKED
42
43
44 }wrt_ocsp_widget_verification_status_t;
45
46 //-------------Initialization and shutdown-------------------
47 /*
48  * Establishes connection to security server. Must be called only once.
49  * Returns WRT_OCSP_OK or error
50  */
51 wrt_ocsp_return_t wrt_ocsp_initialize(void);
52
53 /*
54  * Deinitializes internal structures. Must be called only once.
55  * Returns WRT_OCSP_OK or error
56  */
57
58 wrt_ocsp_return_t wrt_ocsp_shutdown(void);
59
60 //-------------Widget verification------------------------------
61 /*
62  * Requests verification for widget identified with 'handle'.
63  * 'status holds server response.
64  * Returns WRT_OCSP_OK or error
65  */
66
67 wrt_ocsp_return_t wrt_ocsp_verify_widget(wrt_ocsp_widget_handle_t handle,
68                                          wrt_ocsp_widget_verification_status_t* status);
69
70
71 #ifdef __cplusplus
72 }
73 #endif
74 #endif //WRT_OCSP_API_H