2 * Copyright (c) 2004 - 2007 Kungliga Tekniska Högskolan
3 * (Royal Institute of Technology, Stockholm, Sweden).
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
17 * 3. Neither the name of the Institute nor the names of its contributors
18 * may be used to endorse or promote products derived from this software
19 * without specific prior written permission.
21 * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
22 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
25 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
36 typedef struct hx509_cert_attribute_data
*hx509_cert_attribute
;
37 typedef struct hx509_cert_data
*hx509_cert
;
38 typedef struct hx509_certs_data
*hx509_certs
;
39 typedef struct hx509_context_data
*hx509_context
;
40 typedef struct hx509_crypto_data
*hx509_crypto
;
41 typedef struct hx509_lock_data
*hx509_lock
;
42 typedef struct hx509_name_data
*hx509_name
;
43 typedef struct hx509_private_key
*hx509_private_key
;
44 typedef struct hx509_validate_ctx_data
*hx509_validate_ctx
;
45 typedef struct hx509_verify_ctx_data
*hx509_verify_ctx
;
46 typedef struct hx509_revoke_ctx_data
*hx509_revoke_ctx
;
47 typedef struct hx509_query_data hx509_query
;
48 typedef void * hx509_cursor
;
49 typedef struct hx509_request_data
*hx509_request
;
50 typedef struct hx509_error_data
*hx509_error
;
51 typedef struct hx509_peer_info
*hx509_peer_info
;
52 typedef struct hx509_ca_tbs
*hx509_ca_tbs
;
53 typedef struct hx509_env
*hx509_env
;
54 typedef struct hx509_crl
*hx509_crl
;
56 typedef void (*hx509_vprint_func
)(void *, const char *, va_list);
59 HX509_VHN_F_ALLOW_NO_MATCH
= 1
63 HX509_VALIDATE_F_VALIDATE
= 1,
64 HX509_VALIDATE_F_VERBOSE
= 2
67 struct hx509_cert_attribute_data
{
69 heim_octet_string data
;
73 HX509_PROMPT_TYPE_PASSWORD
= 0x1, /* password, hidden */
74 HX509_PROMPT_TYPE_QUESTION
= 0x2, /* question, not hidden */
75 HX509_PROMPT_TYPE_INFO
= 0x4 /* infomation, reply doesn't matter */
78 typedef struct hx509_prompt
{
80 hx509_prompt_type type
;
81 heim_octet_string reply
;
84 typedef int (*hx509_prompter_fct
)(void *, const hx509_prompt
*);
86 typedef struct hx509_octet_string_list
{
88 heim_octet_string
*val
;
89 } hx509_octet_string_list
;
91 typedef struct hx509_pem_header
{
92 struct hx509_pem_header
*next
;
98 (*hx509_pem_read_func
)(hx509_context
, const char *, const hx509_pem_header
*,
99 const void *, size_t, void *ctx
);
102 * Options passed to hx509_query_match_option.
105 HX509_QUERY_OPTION_PRIVATE_KEY
= 1,
106 HX509_QUERY_OPTION_KU_ENCIPHERMENT
= 2,
107 HX509_QUERY_OPTION_KU_DIGITALSIGNATURE
= 3,
108 HX509_QUERY_OPTION_KU_KEYCERTSIGN
= 4,
109 HX509_QUERY_OPTION_END
= 0xffff
110 } hx509_query_option
;
112 /* flags to hx509_certs_init */
113 #define HX509_CERTS_CREATE 0x01
115 /* flags to hx509_set_error_string */
116 #define HX509_ERROR_APPEND 0x01
118 /* flags to hx509_cms_unenvelope */
119 #define HX509_CMS_UE_DONT_REQUIRE_KU_ENCIPHERMENT 0x01
121 /* selectors passed to hx509_crypto_select and hx509_crypto_available */
122 #define HX509_SELECT_ALL 0
123 #define HX509_SELECT_DIGEST 1
124 #define HX509_SELECT_PUBLIC_SIG 2
125 #define HX509_SELECT_PUBLIC_ENC 3
126 #define HX509_SELECT_SECRET_ENC 4
128 /* flags to hx509_ca_tbs_set_template */
129 #define HX509_CA_TEMPLATE_SUBJECT 1
130 #define HX509_CA_TEMPLATE_SERIAL 2
131 #define HX509_CA_TEMPLATE_NOTBEFORE 4
132 #define HX509_CA_TEMPLATE_NOTAFTER 8
133 #define HX509_CA_TEMPLATE_SPKI 16
134 #define HX509_CA_TEMPLATE_KU 32
135 #define HX509_CA_TEMPLATE_EKU 64
137 /* flags hx509_cms_create_signed* */
138 #define HX509_CMS_SIGATURE_DETACHED 1
139 #define HX509_CMS_SIGATURE_ID_NAME 2
141 /* hx509_verify_hostname nametype */
143 HX509_HN_HOSTNAME
= 0,
145 } hx509_hostname_type
;
147 #include <hx509-protos.h>