1 /* krb5_asn.h */
2 /* Written by Vern Staats <staatsvr@asc.hpc.mil> for the OpenSSL project,
3 ** using ocsp/{*.h,*asn*.c} as a starting point
4 */
5 
6 /* ====================================================================
7  * Copyright (c) 1998-2000 The OpenSSL Project.  All rights reserved.
8  *
9  * Redistribution and use in source and binary forms, with or without
10  * modification, are permitted provided that the following conditions
11  * are met:
12  *
13  * 1. Redistributions of source code must retain the above copyright
14  *   notice, this list of conditions and the following disclaimer.
15  *
16  * 2. Redistributions in binary form must reproduce the above copyright
17  *   notice, this list of conditions and the following disclaimer in
18  *   the documentation and/or other materials provided with the
19  *   distribution.
20  *
21  * 3. All advertising materials mentioning features or use of this
22  *   software must display the following acknowledgment:
23  *   "This product includes software developed by the OpenSSL Project
24  *   for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
25  *
26  * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
27  *   endorse or promote products derived from this software without
28  *   prior written permission. For written permission, please contact
29  *   openssl-core@openssl.org.
30  *
31  * 5. Products derived from this software may not be called "OpenSSL"
32  *   nor may "OpenSSL" appear in their names without prior written
33  *   permission of the OpenSSL Project.
34  *
35  * 6. Redistributions of any form whatsoever must retain the following
36  *   acknowledgment:
37  *   "This product includes software developed by the OpenSSL Project
38  *   for use in the OpenSSL Toolkit (http://www.openssl.org/)"
39  *
40  * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
41  * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
42  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
43  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE OpenSSL PROJECT OR
44  * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
45  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
46  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
47  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
49  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
50  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
51  * OF THE POSSIBILITY OF SUCH DAMAGE.
52  * ====================================================================
53  *
54  * This product includes cryptographic software written by Eric Young
55  * (eay@cryptsoft.com).  This product includes software written by Tim
56  * Hudson (tjh@cryptsoft.com).
57  *
58  */
59 
60 module deimos.openssl.krb5_asn;
61 
62 import deimos.openssl._d_util;
63 
64 import deimos.openssl.asn1;
65 
66 /*
67 #include <krb5.h>
68 */
69 public import deimos.openssl.safestack;
70 
71 extern (C):
72 nothrow:
73 
74 
75 /*	ASN.1 from Kerberos RFC 1510
76 */
77 
78 /*	EncryptedData ::=   SEQUENCE {
79 **		etype[0]                      INTEGER, -- EncryptionType
80 **		kvno[1]                       INTEGER OPTIONAL,
81 **		cipher[2]                     OCTET STRING -- ciphertext
82 **	}
83 */
84 struct krb5_encdata_st {
85 	ASN1_INTEGER* etype;
86 	ASN1_INTEGER* kvno;
87 	ASN1_OCTET_STRING* cipher;
88 	}
89 alias krb5_encdata_st KRB5_ENCDATA;
90 
91 /+mixin DECLARE_STACK_OF!(KRB5_ENCDATA);+/
92 
93 /*	PrincipalName ::=   SEQUENCE {
94 **		name-type[0]                  INTEGER,
95 **		name-string[1]                SEQUENCE OF GeneralString
96 **	}
97 */
98 struct krb5_princname_st {
99 	ASN1_INTEGER* nametype;
100 	STACK_OF!(ASN1_GENERALSTRING)	*namestring;
101 	}
102 alias krb5_princname_st KRB5_PRINCNAME;
103 
104 /+mixin DECLARE_STACK_OF!(KRB5_PRINCNAME);+/
105 
106 
107 /*	Ticket ::=	[APPLICATION 1] SEQUENCE {
108 **		tkt-vno[0]                    INTEGER,
109 **		realm[1]                      Realm,
110 **		sname[2]                      PrincipalName,
111 **		enc-part[3]                   EncryptedData
112 **	}
113 */
114 struct krb5_tktbody_st {
115 	ASN1_INTEGER* tktvno;
116 	ASN1_GENERALSTRING* realm;
117 	KRB5_PRINCNAME* sname;
118 	KRB5_ENCDATA* encdata;
119 	}
120 alias krb5_tktbody_st KRB5_TKTBODY;
121 
122 alias STACK_OF!(KRB5_TKTBODY) KRB5_TICKET;
123 /+mixin DECLARE_STACK_OF!(KRB5_TKTBODY);+/
124 
125 
126 /*	AP-REQ ::=      [APPLICATION 14] SEQUENCE {
127 **		pvno[0]                       INTEGER,
128 **		msg-type[1]                   INTEGER,
129 **		ap-options[2]                 APOptions,
130 **		ticket[3]                     Ticket,
131 **		authenticator[4]              EncryptedData
132 **	}
133 **
134 **	APOptions ::=   BIT STRING {
135 **		reserved(0), use-session-key(1), mutual-required(2) }
136 */
137 struct krb5_ap_req_st {
138 	ASN1_INTEGER* pvno;
139 	ASN1_INTEGER* msgtype;
140 	ASN1_BIT_STRING* apoptions;
141 	KRB5_TICKET* ticket;
142 	KRB5_ENCDATA* authenticator;
143 	}
144 alias krb5_ap_req_st KRB5_APREQBODY;
145 
146 alias STACK_OF!(KRB5_APREQBODY) KRB5_APREQ;
147 /+mixin DECLARE_STACK_OF!(KRB5_APREQBODY);+/
148 
149 
150 /*	Authenticator Stuff	*/
151 
152 
153 /*	Checksum ::=   SEQUENCE {
154 **		cksumtype[0]                  INTEGER,
155 **		checksum[1]                   OCTET STRING
156 **	}
157 */
158 struct krb5_checksum_st {
159 	ASN1_INTEGER* ctype;
160 	ASN1_OCTET_STRING* checksum;
161 	}
162 alias krb5_checksum_st KRB5_CHECKSUM;
163 
164 /+mixin DECLARE_STACK_OF!(KRB5_CHECKSUM);+/
165 
166 
167 /*	EncryptionKey ::=   SEQUENCE {
168 **		keytype[0]                    INTEGER,
169 **		keyvalue[1]                   OCTET STRING
170 **	}
171 */
172 struct krb5_encryptionkey_st {
173 	ASN1_INTEGER* ktype;
174 	ASN1_OCTET_STRING* keyvalue;
175 	}
176 alias krb5_encryptionkey_st KRB5_ENCKEY;
177 
178 /+mixin DECLARE_STACK_OF!(KRB5_ENCKEY);+/
179 
180 
181 /*	AuthorizationData ::=   SEQUENCE OF SEQUENCE {
182 **		ad-type[0]                    INTEGER,
183 **             ad-data[1]                    OCTET STRING
184 **	}
185 */
186 struct krb5_authorization_st {
187 	ASN1_INTEGER* adtype;
188 	ASN1_OCTET_STRING* addata;
189 	}
190 alias krb5_authorization_st KRB5_AUTHDATA;
191 
192 /+mixin DECLARE_STACK_OF!(KRB5_AUTHDATA);+/
193 
194 
195 /*	-- Unencrypted authenticator
196 **	Authenticator ::=    [APPLICATION 2] SEQUENCE    {
197 **		authenticator-vno[0]          INTEGER,
198 **		crealm[1]                     Realm,
199 **		cname[2]                      PrincipalName,
200 **		cksum[3]                      Checksum OPTIONAL,
201 **		cusec[4]                      INTEGER,
202 **		ctime[5]                      KerberosTime,
203 **		subkey[6]                     EncryptionKey OPTIONAL,
204 **		seq-number[7]                 INTEGER OPTIONAL,
205 **		authorization-data[8]         AuthorizationData OPTIONAL
206 **	}
207 */
208 struct krb5_authenticator_st {
209 	ASN1_INTEGER* avno;
210 	ASN1_GENERALSTRING* crealm;
211 	KRB5_PRINCNAME* cname;
212 	KRB5_CHECKSUM* cksum;
213 	ASN1_INTEGER* cusec;
214 	ASN1_GENERALIZEDTIME* ctime;
215 	KRB5_ENCKEY* subkey;
216 	ASN1_INTEGER* seqnum;
217 	KRB5_AUTHDATA* authorization;
218 	}
219 alias krb5_authenticator_st KRB5_AUTHENTBODY;
220 
221 alias STACK_OF!(KRB5_AUTHENTBODY) KRB5_AUTHENT;
222 /+mixin DECLARE_STACK_OF!(KRB5_AUTHENTBODY);+/
223 
224 
225 /* DECLARE_ASN1_FUNCTIONS(type) = DECLARE_ASN1_FUNCTIONS_name(type, type) =
226 **	type* name##_new();
227 **	void name##_free(type* a);
228 **	DECLARE_ASN1_ENCODE_FUNCTIONS(type, name, name) =
229 **	 DECLARE_ASN1_ENCODE_FUNCTIONS(type, itname, name) =
230 **	  type* d2i_##name(type** a, const(ubyte)** in_, c_long len);
231 **	  int i2d_##name(type* a, ubyte** out_);
232 **	  DECLARE_ASN1_ITEM(itname) = OPENSSL_EXTERN const ASN1_ITEM itname##_it
233 */
234 
235 mixin(DECLARE_ASN1_FUNCTIONS!"KRB5_ENCDATA");
236 mixin(DECLARE_ASN1_FUNCTIONS!"KRB5_PRINCNAME");
237 mixin(DECLARE_ASN1_FUNCTIONS!"KRB5_TKTBODY");
238 mixin(DECLARE_ASN1_FUNCTIONS!"KRB5_APREQBODY");
239 mixin(DECLARE_ASN1_FUNCTIONS!"KRB5_TICKET");
240 mixin(DECLARE_ASN1_FUNCTIONS!"KRB5_APREQ");
241 
242 mixin(DECLARE_ASN1_FUNCTIONS!"KRB5_CHECKSUM");
243 mixin(DECLARE_ASN1_FUNCTIONS!"KRB5_ENCKEY");
244 mixin(DECLARE_ASN1_FUNCTIONS!"KRB5_AUTHDATA");
245 mixin(DECLARE_ASN1_FUNCTIONS!"KRB5_AUTHENTBODY");
246 mixin(DECLARE_ASN1_FUNCTIONS!"KRB5_AUTHENT");
247 
248 
249 /* BEGIN ERROR CODES */
250 /* The following lines are auto generated by the script mkerr.pl. Any changes
251  * made after this point may be overwritten when the script is next run.
252  */