fixed 64 bit issue
[strongswan.git] / src / libstrongswan / crypto / certinfo.h
1 /**
2 * @file certinfo.h
3 *
4 * @brief Interface of certinfo_t.
5 *
6 */
7
8 /*
9 * Copyright (C) 2006 Andreas Steffen
10 * Hochschule fuer Technik Rapperswil
11 *
12 * This program is free software; you can redistribute it and/or modify it
13 * under the terms of the GNU General Public License as published by the
14 * Free Software Foundation; either version 2 of the License, or (at your
15 * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
16 *
17 * This program is distributed in the hope that it will be useful, but
18 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
19 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
20 * for more details.
21 */
22
23 #ifndef CERTINFO_H_
24 #define CERTINFO_H_
25
26 typedef enum cert_status_t cert_status_t;
27 typedef enum crl_reason_t crl_reason_t;
28 typedef struct certinfo_t certinfo_t;
29
30 #include <library.h>
31
32 /**
33 * RFC 2560 OCSP - certificate status
34 */
35 enum cert_status_t {
36 CERT_GOOD = 0,
37 CERT_REVOKED = 1,
38 CERT_UNKNOWN = 2,
39 CERT_UNDEFINED = 3,
40 CERT_UNTRUSTED = 4 /* private use */
41 };
42
43 extern enum_name_t *cert_status_names;
44
45 /**
46 * RFC 2459 CRL reason codes
47 */
48 enum crl_reason_t {
49 REASON_UNSPECIFIED = 0,
50 REASON_KEY_COMPROMISE = 1,
51 REASON_CA_COMPROMISE = 2,
52 REASON_AFFILIATION_CHANGED = 3,
53 REASON_SUPERSEDED = 4,
54 REASON_CESSATION_OF_OPERATON = 5,
55 REASON_CERTIFICATE_HOLD = 6,
56 REASON_REMOVE_FROM_CRL = 8
57 };
58
59 extern enum_name_t *crl_reason_names;
60
61 /**
62 * @brief X.509 certificate status information
63 *
64 * @ingroup transforms
65 */
66 struct certinfo_t {
67
68 /**
69 * @brief Get serial number.
70 *
71 * @param this calling object
72 * @return serialNumber
73 */
74 chunk_t (*get_serialNumber) (const certinfo_t *this);
75
76 /**
77 * @brief Set certificate status.
78 *
79 * @param this calling object
80 * @param status status
81 */
82 void (*set_status) (certinfo_t *this, cert_status_t status);
83
84 /**
85 * @brief Get certificate status.
86 *
87 * @param this calling object
88 * @return status
89 */
90 cert_status_t (*get_status) (const certinfo_t *this);
91
92 /**
93 * @brief Set nextUpdate.
94 *
95 * @param this calling object
96 * @return nextUpdate
97 */
98 void (*set_nextUpdate) (certinfo_t *this, time_t nextUpdate);
99
100 /**
101 * @brief Get nextUpdate.
102 *
103 * @param this calling object
104 * @return nextUpdate
105 */
106 time_t (*get_nextUpdate) (const certinfo_t *this);
107
108 /**
109 * @brief Set revocationTime.
110 *
111 * @param this calling object
112 * @param revocationTime revocationTime
113 */
114 void (*set_revocationTime) (certinfo_t *this, time_t revocationTime);
115
116 /**
117 * @brief Get revocationTime.
118 *
119 * @param this calling object
120 * @return revocationTime
121 */
122 time_t (*get_revocationTime) (const certinfo_t *this);
123
124 /**
125 * @brief Set revocationReason.
126 *
127 * @param this calling object
128 * @param reason revocationReason
129 */
130 void (*set_revocationReason) (certinfo_t *this, crl_reason_t reason);
131
132 /**
133 * @brief Get revocationReason.
134 *
135 * @param this calling object
136 * @return revocationReason
137 */
138 crl_reason_t (*get_revocationReason) (const certinfo_t *this);
139
140 /**
141 * @brief Destroys the certinfo_t object.
142 *
143 * @param this crl to destroy
144 */
145 void (*destroy) (certinfo_t *this);
146
147 };
148
149 /**
150 * @brief Create a certinfo_t object.
151 *
152 * @param serial chunk serial number of the certificate
153 * @return created certinfo_t object
154 *
155 * @ingroup transforms
156 */
157 certinfo_t *certinfo_create(chunk_t serial);
158
159 #endif /* CERTINFO_H_ */