Eneboo - Documentación para desarrolladores
src/libdigidoc/openssl/include/openssl/kssl.h
Ir a la documentación de este archivo.
00001 /* ssl/kssl.h -*- mode: C; c-file-style: "eay" -*- */
00002 /* Written by Vern Staats <staatsvr@asc.hpc.mil> for the OpenSSL project 2000.
00003  * project 2000.
00004  */
00005 /* ====================================================================
00006  * Copyright (c) 2000 The OpenSSL Project.  All rights reserved.
00007  *
00008  * Redistribution and use in source and binary forms, with or without
00009  * modification, are permitted provided that the following conditions
00010  * are met:
00011  *
00012  * 1. Redistributions of source code must retain the above copyright
00013  *    notice, this list of conditions and the following disclaimer. 
00014  *
00015  * 2. Redistributions in binary form must reproduce the above copyright
00016  *    notice, this list of conditions and the following disclaimer in
00017  *    the documentation and/or other materials provided with the
00018  *    distribution.
00019  *
00020  * 3. All advertising materials mentioning features or use of this
00021  *    software must display the following acknowledgment:
00022  *    "This product includes software developed by the OpenSSL Project
00023  *    for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
00024  *
00025  * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
00026  *    endorse or promote products derived from this software without
00027  *    prior written permission. For written permission, please contact
00028  *    licensing@OpenSSL.org.
00029  *
00030  * 5. Products derived from this software may not be called "OpenSSL"
00031  *    nor may "OpenSSL" appear in their names without prior written
00032  *    permission of the OpenSSL Project.
00033  *
00034  * 6. Redistributions of any form whatsoever must retain the following
00035  *    acknowledgment:
00036  *    "This product includes software developed by the OpenSSL Project
00037  *    for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
00038  *
00039  * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
00040  * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00041  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
00042  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE OpenSSL PROJECT OR
00043  * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
00044  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
00045  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
00046  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
00047  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
00048  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
00049  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
00050  * OF THE POSSIBILITY OF SUCH DAMAGE.
00051  * ====================================================================
00052  *
00053  * This product includes cryptographic software written by Eric Young
00054  * (eay@cryptsoft.com).  This product includes software written by Tim
00055  * Hudson (tjh@cryptsoft.com).
00056  *
00057  */
00058 
00059 /*
00060 **      19990701        VRS     Started.
00061 */
00062 
00063 #ifndef KSSL_H
00064 #define KSSL_H
00065 
00066 #include <openssl/opensslconf.h>
00067 
00068 #ifndef OPENSSL_NO_KRB5
00069 
00070 #include <stdio.h>
00071 #include <ctype.h>
00072 #include <krb5.h>
00073 
00074 #ifdef  __cplusplus
00075 extern "C" {
00076 #endif
00077 
00078 /*
00079 **      Depending on which KRB5 implementation used, some types from
00080 **      the other may be missing.  Resolve that here and now
00081 */
00082 #ifdef KRB5_HEIMDAL
00083 typedef unsigned char krb5_octet;
00084 #define FAR
00085 #else
00086 
00087 #ifndef FAR
00088 #define FAR
00089 #endif
00090 
00091 #endif
00092 
00093 /*      Uncomment this to debug kssl problems or
00094 **      to trace usage of the Kerberos session key
00095 **
00096 **      #define         KSSL_DEBUG
00097 */
00098 
00099 #ifndef KRB5SVC
00100 #define KRB5SVC "host"
00101 #endif
00102 
00103 #ifndef KRB5KEYTAB
00104 #define KRB5KEYTAB      "/etc/krb5.keytab"
00105 #endif
00106 
00107 #ifndef KRB5SENDAUTH
00108 #define KRB5SENDAUTH    1
00109 #endif
00110 
00111 #ifndef KRB5CHECKAUTH
00112 #define KRB5CHECKAUTH   1
00113 #endif
00114 
00115 #ifndef KSSL_CLOCKSKEW
00116 #define KSSL_CLOCKSKEW  300;
00117 #endif
00118 
00119 #define KSSL_ERR_MAX    255
00120 typedef struct kssl_err_st  {
00121         int  reason;
00122         char text[KSSL_ERR_MAX+1];
00123         } KSSL_ERR;
00124 
00125 
00126 /*      Context for passing
00127 **              (1) Kerberos session key to SSL, and
00128 **              (2)     Config data between application and SSL lib
00129 */
00130 typedef struct kssl_ctx_st
00131         {
00132                                 /*      used by:    disposition:            */
00133         char *service_name;     /*      C,S         default ok (kssl)       */
00134         char *service_host;     /*      C           input, REQUIRED         */
00135         char *client_princ;     /*      S           output from krb5 ticket */
00136         char *keytab_file;      /*      S           NULL (/etc/krb5.keytab) */
00137         char *cred_cache;       /*      C           NULL (default)          */
00138         krb5_enctype enctype;
00139         int length;
00140         krb5_octet FAR *key;
00141         } KSSL_CTX;
00142 
00143 #define KSSL_CLIENT     1
00144 #define KSSL_SERVER     2
00145 #define KSSL_SERVICE    3
00146 #define KSSL_KEYTAB     4
00147 
00148 #define KSSL_CTX_OK     0
00149 #define KSSL_CTX_ERR    1
00150 #define KSSL_NOMEM      2
00151 
00152 /* Public (for use by applications that use OpenSSL with Kerberos 5 support */
00153 krb5_error_code kssl_ctx_setstring(KSSL_CTX *kssl_ctx, int which, char *text);
00154 KSSL_CTX *kssl_ctx_new(void);
00155 KSSL_CTX *kssl_ctx_free(KSSL_CTX *kssl_ctx);
00156 void kssl_ctx_show(KSSL_CTX *kssl_ctx);
00157 krb5_error_code kssl_ctx_setprinc(KSSL_CTX *kssl_ctx, int which,
00158         krb5_data *realm, krb5_data *entity, int nentities);
00159 krb5_error_code kssl_cget_tkt(KSSL_CTX *kssl_ctx,  krb5_data **enc_tktp,
00160         krb5_data *authenp, KSSL_ERR *kssl_err);
00161 krb5_error_code kssl_sget_tkt(KSSL_CTX *kssl_ctx,  krb5_data *indata,
00162         krb5_ticket_times *ttimes, KSSL_ERR *kssl_err);
00163 krb5_error_code kssl_ctx_setkey(KSSL_CTX *kssl_ctx, krb5_keyblock *session);
00164 void    kssl_err_set(KSSL_ERR *kssl_err, int reason, char *text);
00165 void kssl_krb5_free_data_contents(krb5_context context, krb5_data *data);
00166 krb5_error_code  kssl_build_principal_2(krb5_context context,
00167                         krb5_principal *princ, int rlen, const char *realm,
00168                         int slen, const char *svc, int hlen, const char *host);
00169 krb5_error_code  kssl_validate_times(krb5_timestamp atime,
00170                                         krb5_ticket_times *ttimes);
00171 krb5_error_code  kssl_check_authent(KSSL_CTX *kssl_ctx, krb5_data *authentp,
00172                                     krb5_timestamp *atimep, KSSL_ERR *kssl_err);
00173 unsigned char   *kssl_skip_confound(krb5_enctype enctype, unsigned char *authn);
00174 
00175 #ifdef  __cplusplus
00176 }
00177 #endif
00178 #endif  /* OPENSSL_NO_KRB5      */
00179 #endif  /* KSSL_H       */
 Todo Clases Namespaces Archivos Funciones Variables 'typedefs' Enumeraciones Valores de enumeraciones Propiedades Amigas 'defines'