Grid Community Toolkit  6.2.1705709074 (tag: v6.2.20240202)
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
globus_gsi_credential.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 
23 #ifndef GLOBUS_INCLUDE_GLOBUS_GSI_CREDENTIAL_H
24 #define GLOBUS_INCLUDE_GLOBUS_GSI_CREDENTIAL_H
25 
26 #include "globus_common.h"
27 #include "globus_error_openssl.h"
29 #include "globus_gsi_callback.h"
30 #include "globus_gsi_cert_utils.h"
32 
33 #include "openssl/x509.h"
34 #include "openssl/bio.h"
35 #include "openssl/ssl.h"
36 #include "globus_error_generic.h"
37 #include "globus_error_openssl.h"
38 
39 #ifdef __cplusplus
40 extern "C" {
41 #endif
42 
43 #ifndef GLOBUS_GLOBAL_DOCUMENT_SET
44 
48 #endif
49 
100 #define GLOBUS_GSI_CREDENTIAL_MODULE (&globus_i_gsi_credential_module)
101 
102 extern
103 globus_module_descriptor_t globus_i_gsi_credential_module;
104 
105 #define _GCRSL(s) globus_common_i18n_get_string( \
106  GLOBUS_GSI_CREDENTIAL_MODULE, \
107  s)
108 
162 typedef struct globus_l_gsi_cred_handle_s *
164 
175 typedef struct globus_l_gsi_cred_handle_attrs_s *
177 
178 
180  globus_gsi_cred_handle_t * handle,
181  globus_gsi_cred_handle_attrs_t handle_attrs);
182 
184  globus_gsi_cred_handle_t handle);
185 
187  globus_gsi_cred_handle_t source,
188  globus_gsi_cred_handle_t * dest);
189 
191  globus_gsi_cred_handle_attrs_t * handle_attrs);
192 
194  globus_gsi_cred_handle_attrs_t handle_attrs);
195 
197  globus_gsi_cred_handle_attrs_t source,
198  globus_gsi_cred_handle_attrs_t * dest);
199 
201  globus_gsi_cred_handle_t handle,
202  X509_NAME * desired_subject);
203 
205  globus_gsi_cred_handle_t handle,
206  const char * proxy_filename);
207 
209  globus_gsi_cred_handle_t handle,
210  BIO * bio);
211 
213  globus_gsi_cred_handle_t handle,
214  const char * key_filename,
215  int (*pw_cb)());
216 
218  globus_gsi_cred_handle_t handle,
219  const char * cert_filename);
220 
222  globus_gsi_cred_handle_t handle,
223  BIO * bio);
224 
226  const char * pem_buf,
227  globus_gsi_cred_handle_t * out_handle,
228  X509 ** out_cert,
229  STACK_OF(X509) ** out_cert_chain,
230  char ** out_subject);
231 
233  globus_gsi_cred_handle_t handle,
234  const char * pkcs12_filename);
235 
237  globus_gsi_cred_handle_t handle,
238  BIO * bio);
239 
241  globus_gsi_cred_handle_t handle,
242  const char * proxy_filename);
243 
246  globus_gsi_cred_handle_t cred_handle,
247  globus_gsi_callback_data_t callback_data);
248 
251  globus_gsi_cred_handle_t cred_handle,
252  globus_gsi_callback_data_t callback_data,
253  time_t check_time);
254 
256  globus_gsi_cred_handle_t handle);
257 
259  globus_gsi_cred_handle_t handle,
260  X509_NAME ** subject_name);
261 
263  globus_gsi_cred_handle_t handle,
264  char ** subject_name);
265 
267  globus_gsi_cred_handle_t handle,
268  STACK_OF(OPENSSL_STRING) ** policies);
269 
271  globus_gsi_cred_handle_t handle,
272  STACK_OF(ASN1_OBJECT) ** languages);
273 
274 globus_result_t globus_gsi_cred_get_path_lengths(
275  globus_gsi_cred_handle_t handle,
276  STACK_OF(ASN1_INTEGER) * integer);
277 
279  globus_gsi_cred_handle_t handle,
280  X509_NAME ** issuer_name);
281 
283  globus_gsi_cred_handle_t handle,
284  char ** issuer_name);
285 
287  globus_gsi_cred_handle_t handle,
288  X509_NAME ** identity_name);
289 
291  globus_gsi_cred_handle_t handle,
292  char ** identity_name);
293 
295  globus_gsi_cred_handle_t handle,
296  X509 * cert);
297 
299  globus_gsi_cred_handle_t handle,
300  EVP_PKEY * key);
301 
303  globus_gsi_cred_handle_t handle,
304  STACK_OF(X509) * cert_chain);
305 
307  globus_gsi_cred_handle_t handle,
308  X509 ** cert);
309 
311  globus_gsi_cred_handle_t handle,
312  EVP_PKEY ** key);
313 
315  globus_gsi_cred_handle_t handle,
316  STACK_OF(X509) ** cert_chain);
317 
319  globus_gsi_cred_handle_t handle,
320  globus_gsi_cred_handle_attrs_t * handle_attrs);
321 
323  globus_gsi_cred_handle_t handle,
324  time_t * lifetime);
325 
327  globus_gsi_cred_handle_t handle,
328  time_t * goodtill);
329 
331  globus_gsi_cred_handle_t handle,
333 
335  globus_gsi_cred_handle_t handle,
336  int * key_bits);
337 
338 GLOBUS_DEPRECATED(
340  globus_gsi_cred_handle_attrs_t handle_attrs,
341  const char * ca_cert_dir));
342 
343 GLOBUS_DEPRECATED(
345  globus_gsi_cred_handle_attrs_t handle_attrs,
346  char ** ca_cert_dir));
347 
349  globus_gsi_cred_handle_attrs_t handle_attrs,
350  globus_gsi_cred_type_t search_order[]); /*{PROXY,USER,HOST}*/
351 
352 
354  globus_gsi_cred_handle_attrs_t handle_attrs,
355  globus_gsi_cred_type_t * search_order[]);/*{PROXY,USER,HOST}*/
356 
357 #ifdef __cplusplus
358 }
359 #endif
360 
361 #endif /* GLOBUS_INCLUDE_GLOBUS_GSI_CREDENTIAL_H */
globus_result_t globus_gsi_cred_get_subject_name(globus_gsi_cred_handle_t handle, char **subject_name)
Get credential subject name.
Definition: globus_gsi_cred_handle.c:1145
Globus GSI Callback.
globus_result_t globus_gsi_cred_handle_attrs_copy(globus_gsi_cred_handle_attrs_t source, globus_gsi_cred_handle_attrs_t *dest)
Copy credential handle attributes.
Definition: globus_gsi_cred_handle_attrs.c:159
globus_result_t globus_gsi_cred_get_key_bits(globus_gsi_cred_handle_t cred_handle, int *key_bits)
Get credential strength.
Definition: globus_gsi_cred_handle.c:441
globus_result_t globus_gsi_cred_get_identity_name(globus_gsi_cred_handle_t handle, char **identity_name)
Get identity name.
Definition: globus_gsi_cred_handle.c:1610
Globus GSI Cert Utils Library.
globus_result_t globus_gsi_cred_write_proxy(globus_gsi_cred_handle_t handle, const char *proxy_filename)
Write a proxy credential.
Definition: globus_gsi_credential.c:1850
globus_result_t globus_gsi_cred_get_X509_subject_name(globus_gsi_cred_handle_t handle, X509_NAME **subject_name)
Get credential subject name.
Definition: globus_gsi_cred_handle.c:995
globus_result_t globus_gsi_cred_read_pkcs12(globus_gsi_cred_handle_t handle, const char *pkcs12_filename)
Read certificate and key from a PKCS12 file.
Definition: globus_gsi_credential.c:1519
globus_result_t globus_gsi_cred_get_cert_type(globus_gsi_cred_handle_t handle, globus_gsi_cert_utils_cert_type_t *type)
Get the X.509 certificate type.
Definition: globus_gsi_credential.c:1979
globus_result_t globus_gsi_cred_verify(globus_gsi_cred_handle_t handle)
Verify a credential.
Definition: globus_gsi_cred_handle.c:2042
globus_result_t globus_gsi_cred_handle_destroy(globus_gsi_cred_handle_t handle)
Destroy the credential handle.
Definition: globus_gsi_cred_handle.c:137
struct globus_l_gsi_cred_handle_s * globus_gsi_cred_handle_t
Definition: globus_gsi_credential.h:162
globus_result_t globus_gsi_cred_handle_attrs_init(globus_gsi_cred_handle_attrs_t *handle_attrs)
Initialize credential handle attributes.
Definition: globus_gsi_cred_handle_attrs.c:60
globus_result_t globus_gsi_cred_get_X509_issuer_name(globus_gsi_cred_handle_t handle, X509_NAME **issuer_name)
Get credential issuer name object.
Definition: globus_gsi_cred_handle.c:1482
globus_result_t globus_gsi_cred_get_issuer_name(globus_gsi_cred_handle_t handle, char **issuer_name)
Get issuer name.
Definition: globus_gsi_cred_handle.c:1545
globus_result_t globus_gsi_cred_handle_attrs_set_ca_cert_dir(globus_gsi_cred_handle_attrs_t handle_attrs, const char *ca_cert_dir)
Set the CA certificate directory.
Definition: globus_gsi_cred_handle_attrs.c:235
globus_result_t globus_gsi_cred_get_lifetime(globus_gsi_cred_handle_t cred_handle, time_t *lifetime)
Get credential lifetime.
Definition: globus_gsi_cred_handle.c:396
globus_result_t globus_gsi_cred_get_goodtill(globus_gsi_cred_handle_t cred_handle, time_t *goodtill)
Get credential expiration.
Definition: globus_gsi_cred_handle.c:351
globus_result_t globus_gsi_cred_set_cert(globus_gsi_cred_handle_t handle, X509 *cert)
Set the credential's certificate.
Definition: globus_gsi_cred_handle.c:527
globus_result_t globus_gsi_cred_handle_attrs_set_search_order(globus_gsi_cred_handle_attrs_t handle_attrs, globus_gsi_cred_type_t search_order[])
Set the search order.
Definition: globus_gsi_cred_handle_attrs.c:347
globus_result_t globus_gsi_cred_read_cert_buffer(const char *pem_buf, globus_gsi_cred_handle_t *out_handle, X509 **out_cert, STACK_OF(X509)**out_cert_chain, char **out_subject)
Read certificate chain from a buffer.
Definition: globus_gsi_credential.c:1392
globus_gsi_cred_type_t
Definition: globus_gsi_cred_constants.h:104
globus_result_t globus_gsi_cred_get_cert_chain(globus_gsi_cred_handle_t handle, STACK_OF(X509)**cert_chain)
Get the certificate chain.
Definition: globus_gsi_cred_handle.c:919
globus_result_t globus_gsi_cred_handle_copy(globus_gsi_cred_handle_t source, globus_gsi_cred_handle_t *dest)
Copy a handle.
Definition: globus_gsi_cred_handle.c:185
globus_result_t globus_gsi_cred_write(globus_gsi_cred_handle_t handle, BIO *bio)
Write Credential.
Definition: globus_gsi_credential.c:1766
globus_result_t globus_gsi_cred_set_cert_chain(globus_gsi_cred_handle_t handle, STACK_OF(X509)*cert_chain)
Set the certificate chain.
Definition: globus_gsi_cred_handle.c:821
Globus Generic Error.
globus_result_t globus_gsi_cred_get_policy_languages(globus_gsi_cred_handle_t handle, STACK_OF(ASN1_OBJECT)**policy_languages)
Get certificate chain policy languages.
Definition: globus_gsi_cred_handle.c:1367
globus_result_t globus_gsi_cred_get_key(globus_gsi_cred_handle_t handle, EVP_PKEY **key)
Get the credential's private key.
Definition: globus_gsi_cred_handle.c:744
globus_result_t globus_gsi_cred_handle_init(globus_gsi_cred_handle_t *handle, globus_gsi_cred_handle_attrs_t handle_attrs)
Initialize a Handle.
Definition: globus_gsi_cred_handle.c:57
globus_result_t globus_gsi_cred_get_cert(globus_gsi_cred_handle_t handle, X509 **cert)
Get the credential's certificate.
Definition: globus_gsi_cred_handle.c:597
globus_result_t globus_gsi_cred_read_cert_bio(globus_gsi_cred_handle_t handle, BIO *bio)
Read a certificate chain from a BIO.
Definition: globus_gsi_credential.c:1269
Headers common to all of Globus.
uint32_t globus_result_t
Definition: globus_types.h:99
globus_result_t globus_gsi_cred_read_key(globus_gsi_cred_handle_t handle, const char *key_filename, int(*pw_cb)())
Read a private key.
Definition: globus_gsi_credential.c:1127
globus_result_t globus_gsi_cred_read(globus_gsi_cred_handle_t handle, X509_NAME *desired_subject)
Read a credential.
Definition: globus_gsi_credential.c:200
globus_result_t globus_gsi_cred_handle_attrs_get_search_order(globus_gsi_cred_handle_attrs_t handle_attrs, globus_gsi_cred_type_t **search_order)
Get the search order.
Definition: globus_gsi_cred_handle_attrs.c:405
enum globus_gsi_cert_utils_cert_type_e globus_gsi_cert_utils_cert_type_t
Globus GSI Credential Library.
struct globus_l_gsi_cred_handle_attrs_s * globus_gsi_cred_handle_attrs_t
Definition: globus_gsi_credential.h:175
Globus Error API.
globus_result_t globus_gsi_cred_get_handle_attrs(globus_gsi_cred_handle_t handle, globus_gsi_cred_handle_attrs_t *attrs)
Get the handle attributes.
Definition: globus_gsi_cred_handle.c:291
globus_result_t globus_gsi_cred_get_X509_identity_name(globus_gsi_cred_handle_t handle, X509_NAME **identity_name)
Get X.509 identity.
Definition: globus_gsi_cred_handle.c:1058
globus_result_t globus_gsi_cred_set_key(globus_gsi_cred_handle_t handle, EVP_PKEY *key)
Set the credential's private key.
Definition: globus_gsi_cred_handle.c:656
globus_result_t globus_gsi_cred_verify_cert_chain_when(globus_gsi_cred_handle_t cred_handle, globus_gsi_callback_data_t callback_data_in, time_t check_time)
Verify credential at a specific time.
Definition: globus_gsi_cred_handle.c:1840
globus_result_t globus_gsi_cred_read_proxy(globus_gsi_cred_handle_t handle, const char *proxy_filename)
Read proxy credential.
Definition: globus_gsi_credential.c:823
globus_result_t globus_gsi_cred_handle_attrs_destroy(globus_gsi_cred_handle_attrs_t handle_attrs)
Destroy credential handle attributes.
Definition: globus_gsi_cred_handle_attrs.c:123
globus_result_t globus_gsi_cred_read_proxy_bio(globus_gsi_cred_handle_t handle, BIO *bio)
Read proxy credential from a BIO.
Definition: globus_gsi_credential.c:894
globus_result_t globus_gsi_cred_get_policies(globus_gsi_cred_handle_t handle, STACK_OF(OPENSSL_STRING)**policies)
Get certificate chain policies.
Definition: globus_gsi_cred_handle.c:1207
globus_result_t globus_gsi_cred_verify_cert_chain(globus_gsi_cred_handle_t cred_handle, globus_gsi_callback_data_t callback_data)
Verify credential.
Definition: globus_gsi_cred_handle.c:1690
globus_result_t globus_gsi_cred_read_cert(globus_gsi_cred_handle_t handle, const char *cert_filename)
Read a certificate chain from a file.
Definition: globus_gsi_credential.c:1212
globus_result_t globus_gsi_cred_handle_attrs_get_ca_cert_dir(globus_gsi_cred_handle_attrs_t handle_attrs, char **ca_cert_dir)
Get the CA certificate directory.
Definition: globus_gsi_cred_handle_attrs.c:285
struct globus_l_gsi_callback_data_s * globus_gsi_callback_data_t
Definition: globus_gsi_callback.h:121
Module Descriptor.
Definition: globus_module.h:71