f86816d48e5eaa9e9e3b33e220c73d583ff1972d
[platform/core/security/cert-svc.git] / vcore / src / cert-svc / cocsp.h
1 /**
2  * Copyright (c) 2011 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        cocsp.h
18  * @author      Bartlomiej Grzelewski (b.grzelewski@samsung.com)
19  * @version     1.0
20  * @brief       This is C api for ValidationCore.
21  */
22 #ifndef _CERTSVC_OCSP_C_API_H_
23 #define _CERTSVC_OCSP_C_API_H_
24
25 #include <time.h>
26
27 #include <cert-svc/ccert.h>
28
29 #ifdef __cplusplus
30 extern "C" {
31 #endif
32
33 #define CERTSVC_OCSP_GOOD                (1<<0)
34 #define CERTSVC_OCSP_REVOKED             (1<<1)
35 #define CERTSVC_OCSP_UNKNOWN             (1<<2)
36 #define CERTSVC_OCSP_VERIFICATION_ERROR  (1<<3)
37 #define CERTSVC_OCSP_NO_SUPPORT          (1<<4)
38 #define CERTSVC_OCSP_CONNECTION_FAILED   (1<<5)
39 #define CERTSVC_OCSP_ERROR               (1<<6)
40 /**
41  * Implementation of ocsp call.
42  *
43  * Please note: to verify certificate you need certificate and his parrent.
44  * This function will always verify chain_size-1 certificates from the chain.
45  *
46  * @param[in] chain Certificate to check.
47  * @param[in] chain_size Size of certificate_array
48  * @param[in] trusted Store with trusted certificates (additional certificates
49  *                    that may by reqired during verification process).
50  * @param[in] trusted_size Size of trusted certificate store.
51  * @param[in] url Force OCSP to use specific server. Pass NULL to use OCSP server defined in certificate.
52  * @param[out] status Bit field with description of chain validation.
53  * @return CERTSVC_SUCCESS, CERTSVC_FAIL, CERTSVC_WRONG_ARGUMENT
54  */
55 int certsvc_ocsp_check(CertSvcCertificate *chain,
56                        int chainSize,
57                        CertSvcCertificate *trusted,
58                        int truestedSize,
59                        const char *url,
60                        int *status);
61
62 #ifdef __cplusplus
63 }
64 #endif
65
66 #endif