summaryrefslogtreecommitdiff
path: root/src/libstrongswan/credentials/certificates/ocsp_response.h
blob: 9c5637b9f9ef506c6e8c0c1e3ed487e6a4c86480 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
/*
 * Copyright (C) 2008 Martin Willi
 * Hochschule fuer Technik Rapperswil
 *
 * This program is free software; you can redistribute it and/or modify it
 * under the terms of the GNU General Public License as published by the
 * Free Software Foundation; either version 2 of the License, or (at your
 * option) any later version.  See <http://www.fsf.org/copyleft/gpl.txt>.
 *
 * This program is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
 * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 * for more details.
 */

/**
 * @defgroup ocsp_response ocsp_response
 * @{ @ingroup certificates
 */

#ifndef OCSP_RESPONSE_H_
#define OCSP_RESPONSE_H_

#include <credentials/certificates/x509.h>
#include <credentials/certificates/crl.h>

typedef struct ocsp_response_t ocsp_response_t;
typedef enum ocsp_status_t ocsp_status_t;

/**
 * OCSP response status
 */
enum ocsp_status_t {
	OCSP_SUCCESSFUL 		= 0,
	OCSP_MALFORMEDREQUEST	= 1,
	OCSP_INTERNALERROR		= 2,
	OCSP_TRYLATER			= 3,
	OCSP_SIGREQUIRED		= 5,
	OCSP_UNAUTHORIZED		= 6,
};

/**
 * enum names for ocsp_status_t
 */
extern enum_name_t *ocsp_status_names;

/**
 * OCSP response message.
 */
struct ocsp_response_t {

	/**
	 * Implements certificate_t interface
	 */
	certificate_t certificate;

	/**
	 * Check the status of a certificate by this OCSP response.
	 *
	 * @param subject			certificate to check status
	 * @param issuer			issuer certificate of subject
	 * @param revocation_time	receives time of revocation, if revoked
	 * @param revocation_reason	receives reason of revocation, if revoked
	 * @param this_update		creation time of revocation list
	 * @param next_update		exptected time of next revocation list
	 * @return					certificate revocation status
	 */
	cert_validation_t (*get_status)(ocsp_response_t *this,
									x509_t *subject, x509_t *issuer,
									time_t *revocation_time,
									crl_reason_t *revocation_reason,
									time_t *this_update, time_t *next_update);

	/**
	 * Create an enumerator over the contained certificates.
	 *
	 * @return					enumerator over certificate_t*
	 */
	enumerator_t* (*create_cert_enumerator)(ocsp_response_t *this);
};

#endif /** OCSP_RESPONSE_H_ @}*/