LTKCPP-- LLRP Toolkit C Plus Plus Library
krb5_asn.h
00001 /* krb5_asn.h */
00002 /*
00003  * Written by Vern Staats <staatsvr@asc.hpc.mil> for the OpenSSL project, **
00004  * using ocsp/{*.h,*asn*.c} as a starting point
00005  */
00006 
00007 /* ====================================================================
00008  * Copyright (c) 1998-2000 The OpenSSL Project.  All rights reserved.
00009  *
00010  * Redistribution and use in source and binary forms, with or without
00011  * modification, are permitted provided that the following conditions
00012  * are met:
00013  *
00014  * 1. Redistributions of source code must retain the above copyright
00015  *    notice, this list of conditions and the following disclaimer.
00016  *
00017  * 2. Redistributions in binary form must reproduce the above copyright
00018  *    notice, this list of conditions and the following disclaimer in
00019  *    the documentation and/or other materials provided with the
00020  *    distribution.
00021  *
00022  * 3. All advertising materials mentioning features or use of this
00023  *    software must display the following acknowledgment:
00024  *    "This product includes software developed by the OpenSSL Project
00025  *    for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
00026  *
00027  * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
00028  *    endorse or promote products derived from this software without
00029  *    prior written permission. For written permission, please contact
00030  *    openssl-core@openssl.org.
00031  *
00032  * 5. Products derived from this software may not be called "OpenSSL"
00033  *    nor may "OpenSSL" appear in their names without prior written
00034  *    permission of the OpenSSL Project.
00035  *
00036  * 6. Redistributions of any form whatsoever must retain the following
00037  *    acknowledgment:
00038  *    "This product includes software developed by the OpenSSL Project
00039  *    for use in the OpenSSL Toolkit (http://www.openssl.org/)"
00040  *
00041  * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
00042  * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00043  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
00044  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE OpenSSL PROJECT OR
00045  * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
00046  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
00047  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
00048  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
00049  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
00050  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
00051  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
00052  * OF THE POSSIBILITY OF SUCH DAMAGE.
00053  * ====================================================================
00054  *
00055  * This product includes cryptographic software written by Eric Young
00056  * (eay@cryptsoft.com).  This product includes software written by Tim
00057  * Hudson (tjh@cryptsoft.com).
00058  *
00059  */
00060 
00061 #ifndef HEADER_KRB5_ASN_H
00062 # define HEADER_KRB5_ASN_H
00063 
00064 /*
00065  * #include <krb5.h>
00066  */
00067 # include <openssl/safestack.h>
00068 
00069 #ifdef  __cplusplus
00070 extern "C" {
00071 #endif
00072 
00073 /*
00074  * ASN.1 from Kerberos RFC 1510
00075  */
00076 
00077 /*-     EncryptedData ::=   SEQUENCE {
00078  *              etype[0]                      INTEGER, -- EncryptionType
00079  *              kvno[1]                       INTEGER OPTIONAL,
00080  *              cipher[2]                     OCTET STRING -- ciphertext
00081  *      }
00082  */
00083 typedef struct krb5_encdata_st {
00084     ASN1_INTEGER *etype;
00085     ASN1_INTEGER *kvno;
00086     ASN1_OCTET_STRING *cipher;
00087 } KRB5_ENCDATA;
00088 
00089 DECLARE_STACK_OF(KRB5_ENCDATA)
00090 
00091 /*-     PrincipalName ::=   SEQUENCE {
00092  *              name-type[0]                  INTEGER,
00093  *              name-string[1]                SEQUENCE OF GeneralString
00094  *      }
00095  */
00096 typedef struct krb5_princname_st {
00097     ASN1_INTEGER *nametype;
00098     STACK_OF(ASN1_GENERALSTRING) *namestring;
00099 } KRB5_PRINCNAME;
00100 
00101 DECLARE_STACK_OF(KRB5_PRINCNAME)
00102 
00103 /*-     Ticket ::=      [APPLICATION 1] SEQUENCE {
00104  *              tkt-vno[0]                    INTEGER,
00105  *              realm[1]                      Realm,
00106  *              sname[2]                      PrincipalName,
00107  *              enc-part[3]                   EncryptedData
00108  *      }
00109  */
00110 typedef struct krb5_tktbody_st {
00111     ASN1_INTEGER *tktvno;
00112     ASN1_GENERALSTRING *realm;
00113     KRB5_PRINCNAME *sname;
00114     KRB5_ENCDATA *encdata;
00115 } KRB5_TKTBODY;
00116 
00117 typedef STACK_OF(KRB5_TKTBODY) KRB5_TICKET;
00118 DECLARE_STACK_OF(KRB5_TKTBODY)
00119 
00120 /*-     AP-REQ ::=      [APPLICATION 14] SEQUENCE {
00121  *              pvno[0]                       INTEGER,
00122  *              msg-type[1]                   INTEGER,
00123  *              ap-options[2]                 APOptions,
00124  *              ticket[3]                     Ticket,
00125  *              authenticator[4]              EncryptedData
00126  *      }
00127  *
00128  *      APOptions ::=   BIT STRING {
00129  *              reserved(0), use-session-key(1), mutual-required(2) }
00130  */
00131 typedef struct krb5_ap_req_st {
00132     ASN1_INTEGER *pvno;
00133     ASN1_INTEGER *msgtype;
00134     ASN1_BIT_STRING *apoptions;
00135     KRB5_TICKET *ticket;
00136     KRB5_ENCDATA *authenticator;
00137 } KRB5_APREQBODY;
00138 
00139 typedef STACK_OF(KRB5_APREQBODY) KRB5_APREQ;
00140 DECLARE_STACK_OF(KRB5_APREQBODY)
00141 
00142 /*      Authenticator Stuff     */
00143 
00144 /*-     Checksum ::=   SEQUENCE {
00145  *              cksumtype[0]                  INTEGER,
00146  *              checksum[1]                   OCTET STRING
00147  *      }
00148  */
00149 typedef struct krb5_checksum_st {
00150     ASN1_INTEGER *ctype;
00151     ASN1_OCTET_STRING *checksum;
00152 } KRB5_CHECKSUM;
00153 
00154 DECLARE_STACK_OF(KRB5_CHECKSUM)
00155 
00156 /*-     EncryptionKey ::=   SEQUENCE {
00157  *              keytype[0]                    INTEGER,
00158  *              keyvalue[1]                   OCTET STRING
00159  *      }
00160  */
00161 typedef struct krb5_encryptionkey_st {
00162     ASN1_INTEGER *ktype;
00163     ASN1_OCTET_STRING *keyvalue;
00164 } KRB5_ENCKEY;
00165 
00166 DECLARE_STACK_OF(KRB5_ENCKEY)
00167 
00168 /*-     AuthorizationData ::=   SEQUENCE OF SEQUENCE {
00169  *              ad-type[0]                    INTEGER,
00170  *              ad-data[1]                    OCTET STRING
00171  *      }
00172  */
00173 typedef struct krb5_authorization_st {
00174     ASN1_INTEGER *adtype;
00175     ASN1_OCTET_STRING *addata;
00176 } KRB5_AUTHDATA;
00177 
00178 DECLARE_STACK_OF(KRB5_AUTHDATA)
00179 
00180 /*-     -- Unencrypted authenticator
00181  *      Authenticator ::=    [APPLICATION 2] SEQUENCE    {
00182  *              authenticator-vno[0]          INTEGER,
00183  *              crealm[1]                     Realm,
00184  *              cname[2]                      PrincipalName,
00185  *              cksum[3]                      Checksum OPTIONAL,
00186  *              cusec[4]                      INTEGER,
00187  *              ctime[5]                      KerberosTime,
00188  *              subkey[6]                     EncryptionKey OPTIONAL,
00189  *              seq-number[7]                 INTEGER OPTIONAL,
00190  *              authorization-data[8]         AuthorizationData OPTIONAL
00191  *      }
00192  */
00193 typedef struct krb5_authenticator_st {
00194     ASN1_INTEGER *avno;
00195     ASN1_GENERALSTRING *crealm;
00196     KRB5_PRINCNAME *cname;
00197     KRB5_CHECKSUM *cksum;
00198     ASN1_INTEGER *cusec;
00199     ASN1_GENERALIZEDTIME *ctime;
00200     KRB5_ENCKEY *subkey;
00201     ASN1_INTEGER *seqnum;
00202     KRB5_AUTHDATA *authorization;
00203 } KRB5_AUTHENTBODY;
00204 
00205 typedef STACK_OF(KRB5_AUTHENTBODY) KRB5_AUTHENT;
00206 DECLARE_STACK_OF(KRB5_AUTHENTBODY)
00207 
00208 /*-  DECLARE_ASN1_FUNCTIONS(type) = DECLARE_ASN1_FUNCTIONS_name(type, type) =
00209  *      type *name##_new(void);
00210  *      void name##_free(type *a);
00211  *      DECLARE_ASN1_ENCODE_FUNCTIONS(type, name, name) =
00212  *       DECLARE_ASN1_ENCODE_FUNCTIONS(type, itname, name) =
00213  *        type *d2i_##name(type **a, const unsigned char **in, long len);
00214  *        int i2d_##name(type *a, unsigned char **out);
00215  *        DECLARE_ASN1_ITEM(itname) = OPENSSL_EXTERN const ASN1_ITEM itname##_it
00216  */
00217 
00218 DECLARE_ASN1_FUNCTIONS(KRB5_ENCDATA)
00219 DECLARE_ASN1_FUNCTIONS(KRB5_PRINCNAME)
00220 DECLARE_ASN1_FUNCTIONS(KRB5_TKTBODY)
00221 DECLARE_ASN1_FUNCTIONS(KRB5_APREQBODY)
00222 DECLARE_ASN1_FUNCTIONS(KRB5_TICKET)
00223 DECLARE_ASN1_FUNCTIONS(KRB5_APREQ)
00224 
00225 DECLARE_ASN1_FUNCTIONS(KRB5_CHECKSUM)
00226 DECLARE_ASN1_FUNCTIONS(KRB5_ENCKEY)
00227 DECLARE_ASN1_FUNCTIONS(KRB5_AUTHDATA)
00228 DECLARE_ASN1_FUNCTIONS(KRB5_AUTHENTBODY)
00229 DECLARE_ASN1_FUNCTIONS(KRB5_AUTHENT)
00230 
00231 /* BEGIN ERROR CODES */
00232 /*
00233  * The following lines are auto generated by the script mkerr.pl. Any changes
00234  * made after this point may be overwritten when the script is next run.
00235  */
00236 
00237 #ifdef  __cplusplus
00238 }
00239 #endif
00240 #endif