Print OCSP single responses
[strongswan.git] / src / libstrongswan / credentials / certificates / ocsp_response.h
1 /*
2 * Copyright (C) 2008 Martin Willi
3 * Hochschule fuer Technik Rapperswil
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the
7 * Free Software Foundation; either version 2 of the License, or (at your
8 * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
9 *
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13 * for more details.
14 */
15
16 /**
17 * @defgroup ocsp_response ocsp_response
18 * @{ @ingroup certificates
19 */
20
21 #ifndef OCSP_RESPONSE_H_
22 #define OCSP_RESPONSE_H_
23
24 #include <credentials/certificates/x509.h>
25 #include <credentials/certificates/crl.h>
26
27 typedef struct ocsp_response_t ocsp_response_t;
28 typedef enum ocsp_status_t ocsp_status_t;
29
30 /**
31 * OCSP response status
32 */
33 enum ocsp_status_t {
34 OCSP_SUCCESSFUL = 0,
35 OCSP_MALFORMEDREQUEST = 1,
36 OCSP_INTERNALERROR = 2,
37 OCSP_TRYLATER = 3,
38 OCSP_SIGREQUIRED = 5,
39 OCSP_UNAUTHORIZED = 6,
40 };
41
42 /**
43 * enum names for ocsp_status_t
44 */
45 extern enum_name_t *ocsp_status_names;
46
47 /**
48 * OCSP response message.
49 */
50 struct ocsp_response_t {
51
52 /**
53 * Implements certificate_t interface
54 */
55 certificate_t certificate;
56
57 /**
58 * Check the status of a certificate by this OCSP response.
59 *
60 * @param subject certificate to check status
61 * @param issuer issuer certificate of subject
62 * @param revocation_time receives time of revocation, if revoked
63 * @param revocation_reason receives reason of revocation, if revoked
64 * @param this_update creation time of revocation list
65 * @param next_update exptected time of next revocation list
66 * @return certificate revocation status
67 */
68 cert_validation_t (*get_status)(ocsp_response_t *this,
69 x509_t *subject, x509_t *issuer,
70 time_t *revocation_time,
71 crl_reason_t *revocation_reason,
72 time_t *this_update, time_t *next_update);
73
74 /**
75 * Create an enumerator over the contained certificates.
76 *
77 * @return enumerator over certificate_t*
78 */
79 enumerator_t* (*create_cert_enumerator)(ocsp_response_t *this);
80
81 /**
82 * Create an enumerator over the contained responses.
83 *
84 * @return enumerator over major response fields
85 */
86 enumerator_t* (*create_response_enumerator)(ocsp_response_t *this);
87 };
88
89 #endif /** OCSP_RESPONSE_H_ @}*/