Debian Codegraph @

src/ocsp.h

raw
1 /* ocsp.h - OCSP (rfc2560)
2 * Copyright (C) 2003, 2012 g10 Code GmbH
3 *
4 * This file is part of KSBA.
5 *
6 * KSBA is free software; you can redistribute it and/or modify
7 * it under the terms of either
8 *
9 * - the GNU Lesser General Public License as published by the Free
10 * Software Foundation; either version 3 of the License, or (at
11 * your option) any later version.
12 *
13 * or
14 *
15 * - the GNU General Public License as published by the Free
16 * Software Foundation; either version 2 of the License, or (at
17 * your option) any later version.
18 *
19 * or both in parallel, as here.
20 *
21 * KSBA is distributed in the hope that it will be useful, but WITHOUT
22 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
23 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
24 * License for more details.
25 *
26 * You should have received a copies of the GNU General Public License
27 * and the GNU Lesser General Public License along with this program;
28 * if not, see <http://www.gnu.org/licenses/>.
29 */
30
31 #ifndef OCSP_H
32 #define OCSP_H 1
33
34 #include "ksba.h"
35
36
37
38 /* A structure to store certificates read from a response. */
39 struct ocsp_certlist_s {
40 struct ocsp_certlist_s *next;
41 ksba_cert_t cert;
42 };
43
44 /* A structre to save a way extensions. */
45 struct ocsp_extension_s
46 {
47 struct ocsp_extension_s *next;
48 size_t off; /* Offset into DATA to the content of the octet string. */
49 size_t len; /* Length of the octet string. */
50 int crit; /* IsCritical flag. */
51 char data[1]; /* This is made up of the OID string followed by the
52 actual DER data of the extension. */
53 };
54
55
56 /* A structure to keep a information about a single status request. */
57 struct ocsp_reqitem_s {
58 struct ocsp_reqitem_s *next;
59
60 ksba_cert_t cert; /* The target certificate for the request. */
61 ksba_cert_t issuer_cert; /* And the certificate of the issuer. */
62
63 /* The next 4 fields are used to match a response with a request. */
64 unsigned char issuer_name_hash[32]; /* The hash as used by the request. */
65 unsigned char issuer_key_hash[32]; /* The hash as used by the request. */
66 unsigned char *serialno; /* A malloced copy of the serial number. */
67 size_t serialnolen; /* and its length. */
68
69 /* The actual status as parsed from the response. */
70 ksba_isotime_t this_update; /* The thisUpdate value from the response. */
71 ksba_isotime_t next_update; /* The nextUpdate value from the response. */
72 ksba_status_t status; /* Set to the status of the target. */
73 ksba_isotime_t revocation_time; /* The indicated revocation time. */
74 ksba_crl_reason_t revocation_reason; /* The reason given for revocation. */
75 struct ocsp_extension_s *single_extensions; /* List of extensions. */
76 };
77
78 /* A structure used as context for the ocsp subsystem. */
79 struct ksba_ocsp_s {
80 char *digest_oid; /* The OID of the digest algorithm to be
81 used for a request. */
82
83 struct ocsp_reqitem_s *requestlist; /* The list of request items. */
84
85 size_t noncelen; /* 0 if no nonce was sent. */
86 unsigned char nonce[16]; /* The random nonce we sent; actual length
87 is NONCELEN. Warning: If its length is
88 increased, check that the created
89 request will still be valid as we use a
90 hacked implementation. */
91
92 unsigned int sha256_certid; /* If set SHA256 will be used for the CERTID. */
93
94 unsigned char *request_buffer; /* Internal buffer to build the request. */
95 size_t request_buflen;
96
97 size_t hash_offset; /* What area of the response is to be */
98 size_t hash_length; /* hashed. */
99
100 ksba_ocsp_response_status_t response_status; /* Status of the response. */
101 ksba_sexp_t sigval; /* The signature value. */
102 ksba_isotime_t produced_at; /* The time the response was signed. */
103 struct ocsp_certlist_s *received_certs; /* Certificates received in
104 the response. */
105 struct ocsp_extension_s *response_extensions; /* List of extensions. */
106 int bad_nonce; /* The nonce does not match the request. */
107 struct {
108 char *name; /* Allocated DN. */
109 char *keyid; /* Allocated key ID. */
110 size_t keyidlen; /* length of the KeyID. */
111 } responder_id; /* The reponder ID from the response. */
112 };
113
114
115 #endif /*OCSP_H*/