Grid Community Toolkit  6.2.1541705016
globus_gsi_cert_utils.h
Go to the documentation of this file.
1 /*
2  * Copyright 1999-2006 University of Chicago
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
24 #ifndef GLOBUS_GSI_CERT_UTILS_H
25 #define GLOBUS_GSI_CERT_UTILS_H
26 
27 
28 #include "globus_common.h"
29 
30 #ifdef __cplusplus
31 extern "C" {
32 #endif
33 
34 #ifndef GLOBUS_GLOBAL_DOCUMENT_SET
35 
39 #endif
40 
87 #define GLOBUS_GSI_CERT_UTILS_MODULE (&globus_i_gsi_cert_utils_module)
88 
89 extern
90 globus_module_descriptor_t globus_i_gsi_cert_utils_module;
91 
92 #define _CUSL(s) globus_common_i18n_get_string(GLOBUS_GSI_CERT_UTILS_MODULE,\
93  s)
94 
95 #ifndef DOXYGEN
96 
97 #include "openssl/x509.h"
98 #include "openssl/asn1.h"
99 #include "globus_error_openssl.h"
100 #include "globus_gsi_cert_utils_constants.h"
101 
102 #define GLOBUS_GSI_CERT_UTILS_IS_PROXY(cert_type) \
103  ((cert_type & GLOBUS_GSI_CERT_UTILS_TYPE_PROXY_MASK) != 0)
104 
105 #define GLOBUS_GSI_CERT_UTILS_IS_RFC_PROXY(cert_type) \
106  (((cert_type & GLOBUS_GSI_CERT_UTILS_TYPE_PROXY_MASK) != 0) && \
107  ((cert_type & GLOBUS_GSI_CERT_UTILS_TYPE_RFC) != 0))
108 
109 #define GLOBUS_GSI_CERT_UTILS_IS_GSI_3_PROXY(cert_type) \
110  (((cert_type & GLOBUS_GSI_CERT_UTILS_TYPE_PROXY_MASK) != 0) && \
111  ((cert_type & GLOBUS_GSI_CERT_UTILS_TYPE_GSI_3) != 0))
112 
113 #define GLOBUS_GSI_CERT_UTILS_IS_GSI_2_PROXY(cert_type) \
114  (((cert_type & GLOBUS_GSI_CERT_UTILS_TYPE_PROXY_MASK) != 0) && \
115  ((cert_type & GLOBUS_GSI_CERT_UTILS_TYPE_GSI_2) != 0))
116 
117 #define GLOBUS_GSI_CERT_UTILS_IS_INDEPENDENT_PROXY(cert_type) \
118  ((cert_type & GLOBUS_GSI_CERT_UTILS_TYPE_INDEPENDENT_PROXY) != 0)
119 
120 #define GLOBUS_GSI_CERT_UTILS_IS_RESTRICTED_PROXY(cert_type) \
121  ((cert_type & GLOBUS_GSI_CERT_UTILS_TYPE_RESTRICTED_PROXY) != 0)
122 
123 #define GLOBUS_GSI_CERT_UTILS_IS_LIMITED_PROXY(cert_type) \
124  ((cert_type & GLOBUS_GSI_CERT_UTILS_TYPE_LIMITED_PROXY) != 0)
125 
126 #define GLOBUS_GSI_CERT_UTILS_IS_IMPERSONATION_PROXY(cert_type) \
127  ((cert_type & GLOBUS_GSI_CERT_UTILS_TYPE_IMPERSONATION_PROXY) != 0)
128 
131  const ASN1_UTCTIME * ctm,
132  time_t * newtime);
133 
136  X509_NAME * subject,
137  STACK_OF(X509) * cert_chain);
138 
141  STACK_OF(X509) * cert_chain,
142  X509 ** eec);
143 
146  STACK_OF(X509) * cert_chain,
147  X509 ** eec);
148 
151  X509 * cert,
153 
156  const char * subject_string,
157  int length,
158  X509_NAME * x509_name);
159 
160 int
161 globus_i_gsi_cert_utils_dn_cmp(
162  const char * dn1,
163  const char * dn2);
164 
165 /* For backwards compatibility */
166 
167 #define globus_gsi_cert_utils_create_string \
168  globus_common_create_string
169 
170 #define globus_gsi_cert_utils_create_nstring \
171  globus_common_create_nstring
172 
173 #define globus_gsi_cert_utils_v_create_string \
174  globus_common_v_create_string
175 
176 #define globus_gsi_cert_utils_v_create_nstring \
177  globus_common_v_create_nstring
178 
179 #endif /* DOXYGEN */
180 
181 #ifdef __cplusplus
182 }
183 #endif
184 
185 #endif /* GLOBUS_GSI_CERT_UTILS_H */
globus_result_t globus_gsi_cert_utils_get_x509_name(const char *subject_string, int length, X509_NAME *x509_name)
Get the certificate name.
Definition: globus_gsi_cert_utils.c:609
globus_result_t globus_gsi_cert_utils_get_eec(STACK_OF(X509) *cert_chain, X509 **eec)
Get the end-entity certificate from a certificate chain.
Definition: globus_gsi_cert_utils.c:865
globus_result_t globus_gsi_cert_utils_get_cert_type(X509 *cert, globus_gsi_cert_utils_cert_type_t *type)
Get the X509 certificate type.
Definition: globus_gsi_cert_utils.c:298
globus_result_t globus_gsi_cert_utils_make_time(const ASN1_UTCTIME *ctm, time_t *newtime)
Convert ASN1_UTCTIME to time_t.
Definition: globus_gsi_cert_utils.c:188
Globus Generic Error.
Headers common to all of Globus.
uint32_t globus_result_t
Definition: globus_types.h:99
enum globus_gsi_cert_utils_cert_type_e globus_gsi_cert_utils_cert_type_t
globus_result_t globus_gsi_cert_utils_get_identity_cert(STACK_OF(X509) *cert_chain, X509 **identity_cert)
Get the identity certificate from a certificate chain.
Definition: globus_gsi_cert_utils.c:919
globus_result_t globus_gsi_cert_utils_get_base_name(X509_NAME *subject, STACK_OF(X509) *cert_chain)
Get the base certificate name from a certificate chain.
Definition: globus_gsi_cert_utils.c:795
Module Descriptor.
Definition: globus_module.h:69