Grid Community Toolkit  6.2.1653033972 (tag: v6.2.20220524)
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
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 
89 #define GLOBUS_GSI_CERT_UTILS_MODULE (&globus_i_gsi_cert_utils_module)
90 
91 extern
92 globus_module_descriptor_t globus_i_gsi_cert_utils_module;
93 
94 #define _CUSL(s) globus_common_i18n_get_string(GLOBUS_GSI_CERT_UTILS_MODULE,\
95  s)
96 
97 #ifndef DOXYGEN
98 
99 #include "openssl/x509.h"
100 #include "openssl/asn1.h"
101 #include "globus_error_openssl.h"
102 #include "globus_gsi_cert_utils_constants.h"
103 
104 #define GLOBUS_GSI_CERT_UTILS_IS_PROXY(cert_type) \
105  ((cert_type & GLOBUS_GSI_CERT_UTILS_TYPE_PROXY_MASK) != 0)
106 
107 #define GLOBUS_GSI_CERT_UTILS_IS_RFC_PROXY(cert_type) \
108  (((cert_type & GLOBUS_GSI_CERT_UTILS_TYPE_PROXY_MASK) != 0) && \
109  ((cert_type & GLOBUS_GSI_CERT_UTILS_TYPE_RFC) != 0))
110 
111 #define GLOBUS_GSI_CERT_UTILS_IS_GSI_3_PROXY(cert_type) \
112  (((cert_type & GLOBUS_GSI_CERT_UTILS_TYPE_PROXY_MASK) != 0) && \
113  ((cert_type & GLOBUS_GSI_CERT_UTILS_TYPE_GSI_3) != 0))
114 
115 #define GLOBUS_GSI_CERT_UTILS_IS_GSI_2_PROXY(cert_type) \
116  (((cert_type & GLOBUS_GSI_CERT_UTILS_TYPE_PROXY_MASK) != 0) && \
117  ((cert_type & GLOBUS_GSI_CERT_UTILS_TYPE_GSI_2) != 0))
118 
119 #define GLOBUS_GSI_CERT_UTILS_IS_INDEPENDENT_PROXY(cert_type) \
120  ((cert_type & GLOBUS_GSI_CERT_UTILS_TYPE_INDEPENDENT_PROXY) != 0)
121 
122 #define GLOBUS_GSI_CERT_UTILS_IS_RESTRICTED_PROXY(cert_type) \
123  ((cert_type & GLOBUS_GSI_CERT_UTILS_TYPE_RESTRICTED_PROXY) != 0)
124 
125 #define GLOBUS_GSI_CERT_UTILS_IS_LIMITED_PROXY(cert_type) \
126  ((cert_type & GLOBUS_GSI_CERT_UTILS_TYPE_LIMITED_PROXY) != 0)
127 
128 #define GLOBUS_GSI_CERT_UTILS_IS_IMPERSONATION_PROXY(cert_type) \
129  ((cert_type & GLOBUS_GSI_CERT_UTILS_TYPE_IMPERSONATION_PROXY) != 0)
130 
133  const ASN1_UTCTIME * ctm,
134  time_t * newtime);
135 
138  X509_NAME * subject,
139  STACK_OF(X509) * cert_chain);
140 
143  STACK_OF(X509) * cert_chain,
144  X509 ** eec);
145 
148  STACK_OF(X509) * cert_chain,
149  X509 ** eec);
150 
153  X509 * cert,
155 
158  const char * subject_string,
159  int length,
160  X509_NAME * x509_name);
161 
162 int
163 globus_i_gsi_cert_utils_dn_cmp(
164  const char * dn1,
165  const char * dn2);
166 
167 /* For backwards compatibility */
168 
169 #define globus_gsi_cert_utils_create_string \
170  globus_common_create_string
171 
172 #define globus_gsi_cert_utils_create_nstring \
173  globus_common_create_nstring
174 
175 #define globus_gsi_cert_utils_v_create_string \
176  globus_common_v_create_string
177 
178 #define globus_gsi_cert_utils_v_create_nstring \
179  globus_common_v_create_nstring
180 
181 #endif /* DOXYGEN */
182 
183 #ifdef __cplusplus
184 }
185 #endif
186 
187 #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_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
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.
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
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
Module Descriptor.
Definition: globus_module.h:71