1 /* shishi.h --- Header file for Shishi library.                       -*- c -*-
2  * Copyright (C) 2002-2013 Simon Josefsson
3  *
4  * This file is part of Shishi.
5  *
6  * Shishi is free software; you can redistribute it and/or modify it
7  * under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * Shishi is distributed in the hope that it will be useful, but
12  * WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  * General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with Shishi; if not, see http://www.gnu.org/licenses or write
18  * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
19  * Floor, Boston, MA 02110-1301, USA
20  *
21  */
22 
23 #ifndef SHISHI_H
24 #define SHISHI_H
25 
26 #include <stddef.h>		/* size_t */
27 #include <stdio.h>		/* FILE */
28 #include <stdarg.h>		/* va_list */
29 #include <time.h>		/* time_t */
30 #include <shishi-int.h>		/* uint32_t */
31 
32 #define SHISHI_VERSION "1.0.2"
33 
34 # ifdef __cplusplus
35 extern "C"
36 {
37 # endif
38 
39 #ifndef __attribute__
40 /* This feature is available in gcc versions 2.5 and later.  */
41 # if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5)
42 #  define __attribute__(Spec)	/* empty */
43 # endif
44 #endif
45 
46 /* Error codes */
47   typedef enum
48   {
49     SHISHI_OK = 0,
50     SHISHI_ASN1_ERROR = 1,
51     SHISHI_FOPEN_ERROR = 2,
52     SHISHI_IO_ERROR = 3,
53     SHISHI_MALLOC_ERROR = 4,
54     SHISHI_BASE64_ERROR = 5,
55     SHISHI_REALM_MISMATCH = 6,
56     SHISHI_CNAME_MISMATCH = 7,
57     SHISHI_NONCE_MISMATCH = 8,
58     SHISHI_TGSREP_BAD_KEYTYPE = 9,
59     SHISHI_KDCREP_BAD_KEYTYPE = 10,
60     SHISHI_APREP_BAD_KEYTYPE = 11,
61     SHISHI_APREP_VERIFY_FAILED = 12,
62     SHISHI_APREQ_BAD_KEYTYPE = 13,
63     SHISHI_TOO_SMALL_BUFFER = 14,
64     SHISHI_DERIVEDKEY_TOO_SMALL = 15,
65     SHISHI_KEY_TOO_LARGE = 16,
66     SHISHI_CRYPTO_ERROR = 17,
67     SHISHI_CRYPTO_INTERNAL_ERROR = 18,
68     SHISHI_SOCKET_ERROR = 19,
69     SHISHI_BIND_ERROR = 20,
70     SHISHI_SENDTO_ERROR = 21,
71     SHISHI_RECVFROM_ERROR = 22,
72     SHISHI_CLOSE_ERROR = 23,
73     SHISHI_KDC_TIMEOUT = 24,
74     SHISHI_KDC_NOT_KNOWN_FOR_REALM = 25,
75     SHISHI_TTY_ERROR = 26,
76     SHISHI_GOT_KRBERROR = 27,
77     SHISHI_HANDLE_ERROR = 28,
78     SHISHI_INVALID_TKTS = 29,
79     SHISHI_TICKET_BAD_KEYTYPE = 30,
80     SHISHI_INVALID_KEY = 31,
81     SHISHI_APREQ_DECRYPT_FAILED = 32,
82     SHISHI_TICKET_DECRYPT_FAILED = 33,
83     SHISHI_INVALID_TICKET = 34,
84     SHISHI_OUT_OF_RANGE = 35,
85     SHISHI_ASN1_NO_ELEMENT = 36,
86     SHISHI_SAFE_BAD_KEYTYPE = 37,
87     SHISHI_SAFE_VERIFY_FAILED = 38,
88     SHISHI_PKCS5_INVALID_PRF = 39,
89     SHISHI_PKCS5_INVALID_ITERATION_COUNT = 40,
90     SHISHI_PKCS5_INVALID_DERIVED_KEY_LENGTH = 41,
91     SHISHI_PKCS5_DERIVED_KEY_TOO_LONG = 42,
92     SHISHI_INVALID_PRINCIPAL_NAME = 43,
93     SHISHI_INVALID_ARGUMENT = 44,
94     SHISHI_ASN1_NO_VALUE = 45,
95     SHISHI_CONNECT_ERROR = 46,
96     SHISHI_VERIFY_FAILED = 47,
97     SHISHI_PRIV_BAD_KEYTYPE = 48,
98     SHISHI_FILE_ERROR = 49,
99     SHISHI_ENCAPREPPART_BAD_KEYTYPE = 50,
100     SHISHI_GETTIMEOFDAY_ERROR = 51,
101     SHISHI_KEYTAB_ERROR = 52,
102     SHISHI_CCACHE_ERROR = 53,
103     SHISHI_LAST_ERROR = 53
104   }
105   Shishi_rc;
106 
107   typedef enum
108   {
109     /* Name type not known */
110     SHISHI_NT_UNKNOWN = 0,
111     /* Just the name of the principal as in DCE, or for users */
112     SHISHI_NT_PRINCIPAL = 1,
113     /* Service and other unique instance (krbtgt) */
114     SHISHI_NT_SRV_INST = 2,
115     /* Service with host name as instance (telnet, rcommands) */
116     SHISHI_NT_SRV_HST = 3,
117     /* Service with host as remaining components */
118     SHISHI_NT_SRV_XHST = 4,
119     /* Unique ID */
120     SHISHI_NT_UID = 5,
121     /* Encoded X.509 Distingished name [RFC 2253] */
122     SHISHI_NT_X500_PRINCIPAL = 6,
123     /* Name in form of SMTP email name (e.g. user@foo.com) */
124     SHISHI_NT_SMTP_NAME = 7,
125     /*  Enterprise name - may be mapped to principal name */
126     SHISHI_NT_ENTERPRISE = 10
127   }
128   Shishi_name_type;
129 
130   typedef enum
131   {
132     SHISHI_PA_TGS_REQ = 1,
133     SHISHI_PA_ENC_TIMESTAMP = 2,
134     SHISHI_PA_PW_SALT = 3,
135     SHISHI_PA_RESERVED = 4,
136     SHISHI_PA_ENC_UNIX_TIME = 5,	/* (deprecated) */
137     SHISHI_PA_SANDIA_SECUREID = 6,
138     SHISHI_PA_SESAME = 7,
139     SHISHI_PA_OSF_DCE = 8,
140     SHISHI_PA_CYBERSAFE_SECUREID = 9,
141     SHISHI_PA_AFS3_SALT = 10,
142     SHISHI_PA_ETYPE_INFO = 11,
143     SHISHI_PA_SAM_CHALLENGE = 12,	/* (sam/otp) */
144     SHISHI_PA_SAM_RESPONSE = 13,	/* (sam/otp) */
145     SHISHI_PA_PK_AS_REQ = 14,	/* (pkinit) */
146     SHISHI_PA_PK_AS_REP = 15,	/* (pkinit) */
147     SHISHI_PA_ETYPE_INFO2 = 19,	/* (replaces pa_etype_info) */
148     SHISHI_PA_USE_SPECIFIED_KVNO = 20,
149     SHISHI_PA_SAM_REDIRECT = 21,	/* (sam/otp) */
150     SHISHI_PA_GET_FROM_TYPED_DATA = 22,	/* (embedded in typed data) */
151     SHISHI_TD_PADATA = 22,	/* (embeds padata) */
152     SHISHI_PA_SAM_ETYPE_INFO = 23,	/* (sam/otp) */
153     SHISHI_PA_ALT_PRINC = 24,	/* (crawdad@fnal.gov) */
154     SHISHI_PA_SAM_CHALLENGE2 = 30,	/* (kenh@pobox.com) */
155     SHISHI_PA_SAM_RESPONSE2 = 31,	/* (kenh@pobox.com) */
156     SHISHI_PA_EXTRA_TGT = 41,	/* Reserved extra TGT */
157     SHISHI_TD_PKINIT_CMS_CERTIFICATES = 101,	/* CertificateSet from CMS */
158     SHISHI_TD_KRB_PRINCIPAL = 102,	/* PrincipalName */
159     SHISHI_TD_KRB_REALM = 103,	/* Realm */
160     SHISHI_TD_TRUSTED_CERTIFIERS = 104,	/* from PKINIT */
161     SHISHI_TD_CERTIFICATE_INDEX = 105,	/* from PKINIT */
162     SHISHI_TD_APP_DEFINED_ERROR = 106,	/* application specific */
163     SHISHI_TD_REQ_NONCE = 107,	/* INTEGER */
164     SHISHI_TD_REQ_SEQ = 108,	/* INTEGER */
165     SHISHI_PA_PAC_REQUEST = 128	/* (jbrezak@exchange.microsoft.com) */
166   }
167   Shishi_padata_type;
168 
169   typedef enum
170   {
171     SHISHI_TR_DOMAIN_X500_COMPRESS = 1
172   }
173   Shishi_tr_type;
174 
175   typedef enum
176   {
177     SHISHI_APOPTIONS_RESERVED = 0x1,	/* bit 0 */
178     SHISHI_APOPTIONS_USE_SESSION_KEY = 0x2,	/* bit 1 */
179     SHISHI_APOPTIONS_MUTUAL_REQUIRED = 0x4	/* bit 2 */
180   }
181   Shishi_apoptions;
182 
183   typedef enum
184   {
185     SHISHI_TICKETFLAGS_RESERVED = 0x1,	/* bit 0 */
186     SHISHI_TICKETFLAGS_FORWARDABLE = 0x2,	/* bit 1 */
187     SHISHI_TICKETFLAGS_FORWARDED = 0x4,	/* bit 2 */
188     SHISHI_TICKETFLAGS_PROXIABLE = 0x8,	/* bit 3 */
189     SHISHI_TICKETFLAGS_PROXY = 0x10,	/* bit 4 */
190     SHISHI_TICKETFLAGS_MAY_POSTDATE = 0x20,	/* bit 5 */
191     SHISHI_TICKETFLAGS_POSTDATED = 0x40,	/* bit 6 */
192     SHISHI_TICKETFLAGS_INVALID = 0x80,	/* bit 7 */
193     SHISHI_TICKETFLAGS_RENEWABLE = 0x100,	/* bit 8 */
194     SHISHI_TICKETFLAGS_INITIAL = 0x200,	/* bit 9 */
195     SHISHI_TICKETFLAGS_PRE_AUTHENT = 0x400,	/* bit 10 */
196     SHISHI_TICKETFLAGS_HW_AUTHENT = 0x800,	/* bit 11 */
197     SHISHI_TICKETFLAGS_TRANSITED_POLICY_CHECKED = 0x1000,	/* bit 12 */
198     SHISHI_TICKETFLAGS_OK_AS_DELEGATE = 0x2000	/* bit 13 */
199   }
200   Shishi_ticketflags;
201 
202   typedef enum
203   {
204     SHISHI_KDCOPTIONS_RESERVED = 0x1,	/* bit 0 */
205     SHISHI_KDCOPTIONS_FORWARDABLE = 0x2,	/* bit 1 */
206     SHISHI_KDCOPTIONS_FORWARDED = 0x4,	/* bit 2 */
207     SHISHI_KDCOPTIONS_PROXIABLE = 0x8,	/* bit 3 */
208     SHISHI_KDCOPTIONS_PROXY = 0x10,	/* bit 4 */
209     SHISHI_KDCOPTIONS_ALLOW_POSTDATE = 0x20,	/* bit 5 */
210     SHISHI_KDCOPTIONS_POSTDATED = 0x40,	/* bit 6 */
211     SHISHI_KDCOPTIONS_UNUSED7 = 0x80,	/* bit 7 */
212     SHISHI_KDCOPTIONS_RENEWABLE = 0x100,	/* bit 8 */
213     SHISHI_KDCOPTIONS_UNUSED9 = 0x200,	/* bit 9 */
214     SHISHI_KDCOPTIONS_UNUSED10 = 0x400,	/* bit 10 */
215     SHISHI_KDCOPTIONS_UNUSED11 = 0x800	/* bit 11 */
216 #define SHISHI_KDCOPTIONS_DISABLE_TRANSITED_CHECK 0x4000000	/* bit 26 */
217 #define SHISHI_KDCOPTIONS_RENEWABLE_OK		  0x8000000	/* bit 27 */
218 #define SHISHI_KDCOPTIONS_ENC_TKT_IN_SKEY	  0x10000000	/* bit 28 */
219 #define SHISHI_KDCOPTIONS_RENEW			  0x40000000	/* bit 30 */
220 #define SHISHI_KDCOPTIONS_VALIDATE		  0x80000000	/* bit 31 */
221   }
222   Shishi_KDCOptions;
223 
224   typedef enum
225   {
226     /* 0                             unused */
227     /* 1              Ticket         PDU */
228     /* 2              Authenticator  non-PDU */
229     /* 3              EncTicketPart  non-PDU */
230     /* 4-9                           unused */
231     /* Request for initial authentication */
232     SHISHI_MSGTYPE_AS_REQ = 10,
233     /* Response to SHISHI_MSGTYPE_AS_REQ request */
234     SHISHI_MSGTYPE_AS_REP = 11,
235     /* Request for authentication based on TGT */
236     SHISHI_MSGTYPE_TGS_REQ = 12,
237     /* Response to SHISHI_MSGTYPE_TGS_REQ request */
238     SHISHI_MSGTYPE_TGS_REP = 13,
239     /* application request to server */
240     SHISHI_MSGTYPE_AP_REQ = 14,
241     /* Response to SHISHI_MSGTYPE_AP_REQ_MUTUAL */
242     SHISHI_MSGTYPE_AP_REP = 15,
243     /* Reserved for user-to-user krb_tgt_request */
244     SHISHI_MSGTYPE_RESERVED16 = 16,
245     /* Reserved for user-to-user krb_tgt_reply */
246     SHISHI_MSGTYPE_RESERVED17 = 17,
247     /* 18-19                         unused */
248     /* Safe (checksummed) application message */
249     SHISHI_MSGTYPE_SAFE = 20,
250     /* Private (encrypted) application message */
251     SHISHI_MSGTYPE_PRIV = 21,
252     /* Private (encrypted) message to forward credentials */
253     SHISHI_MSGTYPE_CRED = 22,
254     /* 23-24                         unused */
255     /* 25             EncASRepPart   non-PDU */
256     /* 26             EncTGSRepPart  non-PDU */
257     /* 27             EncApRepPart   non-PDU */
258     /* 28             EncKrbPrivPart non-PDU */
259     /* 29             EncKrbCredPart non-PDU */
260     /* Error response */
261     SHISHI_MSGTYPE_ERROR = 30
262   }
263   Shishi_msgtype;
264 
265   typedef enum
266   {
267     SHISHI_LRTYPE_LAST_INITIAL_TGT_REQUEST = 1,
268     SHISHI_LRTYPE_LAST_INITIAL_REQUEST = 2,
269     SHISHI_LRTYPE_NEWEST_TGT_ISSUE = 3,
270     SHISHI_LRTYPE_LAST_RENEWAL = 4,
271     SHISHI_LRTYPE_LAST_REQUEST = 5
272   }
273   Shishi_lrtype;
274 
275   typedef enum
276   {
277     SHISHI_NULL = 0,
278     SHISHI_DES_CBC_CRC = 1,
279     SHISHI_DES_CBC_MD4 = 2,
280     SHISHI_DES_CBC_MD5 = 3,
281     SHISHI_DES_CBC_NONE = 4,
282     SHISHI_DES3_CBC_NONE = 6,
283     SHISHI_DES3_CBC_HMAC_SHA1_KD = 16,
284     SHISHI_AES128_CTS_HMAC_SHA1_96 = 17,
285     SHISHI_AES256_CTS_HMAC_SHA1_96 = 18,
286     SHISHI_ARCFOUR_HMAC = 23,
287     SHISHI_ARCFOUR_HMAC_EXP = 24
288   }
289   Shishi_etype;
290 
291   typedef enum
292   {
293     SHISHI_CRC32 = 1,
294     SHISHI_RSA_MD4 = 2,
295     SHISHI_RSA_MD4_DES = 3,
296     SHISHI_DES_MAC = 4,
297     SHISHI_DES_MAC_K = 5,
298     SHISHI_RSA_MD4_DES_K = 6,
299     SHISHI_RSA_MD5 = 7,
300     SHISHI_RSA_MD5_DES = 8,
301     SHISHI_RSA_MD5_DES_GSS = 9,	/* XXX */
302     SHISHI_HMAC_SHA1_DES3_KD = 12,
303     SHISHI_HMAC_SHA1_96_AES128 = 15,
304     SHISHI_HMAC_SHA1_96_AES256 = 16,
305     SHISHI_ARCFOUR_HMAC_MD5 = -138,
306     SHISHI_KRB5_GSSAPI_CKSUM = 8003,
307     SHISHI_NO_CKSUMTYPE = -1
308   }
309   Shishi_cksumtype;
310 
311   typedef enum
312   {
313     SHISHI_FILETYPE_TEXT = 0,
314     SHISHI_FILETYPE_DER,
315     SHISHI_FILETYPE_HEX,
316     SHISHI_FILETYPE_BASE64,
317     SHISHI_FILETYPE_BINARY
318   }
319   Shishi_filetype;
320 
321   typedef enum
322   {
323     SHISHI_OUTPUTTYPE_NULL = 0,
324     SHISHI_OUTPUTTYPE_STDERR,
325     SHISHI_OUTPUTTYPE_SYSLOG
326   }
327   Shishi_outputtype;
328 
329   typedef enum
330   {
331     SHISHI_AUTHORIZATION_BASIC = 0,
332     SHISHI_AUTHORIZATION_K5LOGIN
333   }
334   Shishi_authorization;
335 
336   typedef enum
337   {
338     /* 1. AS-REQ PA-ENC-TIMESTAMP padata timestamp, encrypted with the
339        client key */
340     SHISHI_KEYUSAGE_ASREQ_PA_ENC_TIMESTAMP = 1,
341     /* 2. AS-REP Ticket and TGS-REP Ticket (includes TGS session key or
342        application session key), encrypted with the service key  */
343     SHISHI_KEYUSAGE_ENCTICKETPART = 2,
344     /* 3. AS-REP encrypted part (includes TGS session key or application
345        session key), encrypted with the client key */
346     SHISHI_KEYUSAGE_ENCASREPPART = 3,
347     /* 4. TGS-REQ KDC-REQ-BODY AuthorizationData, encrypted with the TGS
348        session key  */
349     SHISHI_KEYUSAGE_TGSREQ_AUTHORIZATIONDATA_TGS_SESSION_KEY = 4,
350     /* 5. TGS-REQ KDC-REQ-BODY AuthorizationData, encrypted with the TGS
351        authenticator subkey (section 5.4.1) */
352     SHISHI_KEYUSAGE_TGSREQ_AUTHORIZATIONDATA_TGS_AUTHENTICATOR_KEY = 5,
353     /* 6. TGS-REQ PA-TGS-REQ padata AP-REQ Authenticator cksum, keyed with the
354        TGS session key  */
355     SHISHI_KEYUSAGE_TGSREQ_APREQ_AUTHENTICATOR_CKSUM = 6,
356     /* 7. TGS-REQ PA-TGS-REQ padata AP-REQ Authenticator (includes TGS
357        authenticator subkey), encrypted with the TGS session key */
358     SHISHI_KEYUSAGE_TGSREQ_APREQ_AUTHENTICATOR = 7,
359     /* 8. TGS-REP encrypted part (includes application session key), encrypted
360        with the TGS session key */
361     SHISHI_KEYUSAGE_ENCTGSREPPART_SESSION_KEY = 8,
362     /* 9. TGS-REP encrypted part (includes application session key), encrypted
363        with the TGS authenticator subkey */
364     SHISHI_KEYUSAGE_ENCTGSREPPART_AUTHENTICATOR_KEY = 9,
365     /* 10. AP-REQ Authenticator cksum, keyed with the application
366        session key */
367     SHISHI_KEYUSAGE_APREQ_AUTHENTICATOR_CKSUM = 10,
368     /* 11. AP-REQ Authenticator (includes application authenticator subkey),
369        encrypted with the application session key */
370     SHISHI_KEYUSAGE_APREQ_AUTHENTICATOR = 11,
371     /* 12. AP-REP encrypted part (includes application session subkey),
372        encrypted with the application session key */
373     SHISHI_KEYUSAGE_ENCAPREPPART = 12,
374     /* 13. KRB-PRIV encrypted part, encrypted with a key chosen by the
375        application */
376     SHISHI_KEYUSAGE_KRB_PRIV = 13,
377     /* 14. KRB-CRED encrypted part, encrypted with a key chosen by the
378        application */
379     SHISHI_KEYUSAGE_KRB_CRED = 14,
380     /* 15. KRB-SAFE cksum, keyed with a key chosen by the application */
381     SHISHI_KEYUSAGE_KRB_SAFE = 15,
382     /* 18. KRB-ERROR checksum (e-cksum) */
383     SHISHI_KEYUSAGE_KRB_ERROR = 18,
384     /* 19. AD-KDCIssued checksum (ad-checksum) */
385     SHISHI_KEYUSAGE_AD_KDCISSUED = 19,
386     /* 20. Checksum for Mandatory Ticket Extensions */
387     SHISHI_KEYUSAGE_TICKET_EXTENSION = 20,
388     /* 21. Checksum in Authorization Data in Ticket Extensions */
389     SHISHI_KEYUSAGE_TICKET_EXTENSION_AUTHORIZATION = 21,
390     /* 22-24. Reserved for use in GSSAPI mechanisms derived from RFC 1964.
391        (raeburn/MIT) */
392     SHISHI_KEYUSAGE_GSS_R1 = 22,
393     SHISHI_KEYUSAGE_GSS_R2 = 23,
394     SHISHI_KEYUSAGE_GSS_R3 = 24,
395     /* draft-ietf-krb-wg-gssapi-cfx */
396     SHISHI_KEYUSAGE_ACCEPTOR_SEAL = 22,
397     SHISHI_KEYUSAGE_ACCEPTOR_SIGN = 23,
398     SHISHI_KEYUSAGE_INITIATOR_SEAL = 24,
399     SHISHI_KEYUSAGE_INITIATOR_SIGN = 25,
400     /* 16-18,20-21,25-511. Reserved for future use. */
401     /* 512-1023.  Reserved for uses internal implementations. */
402     /* 1024.         Encryption for application use in protocols that
403        do not specify key usage values */
404     /* 1025.         Checksums for application use in protocols that
405        do not specify key usage values */
406     /* 1026-2047.      Reserved for application use.
407        1026,1028,1030,1032,1034 used in KCMD protocol */
408     SHISHI_KEYUSAGE_KCMD_DES = 1026,
409     SHISHI_KEYUSAGE_KCMD_INPUT = 1028,
410     SHISHI_KEYUSAGE_KCMD_OUTPUT = 1030,
411     SHISHI_KEYUSAGE_KCMD_STDERR_INPUT = 1032,
412     SHISHI_KEYUSAGE_KCMD_STDERR_OUTPUT = 1034
413   }
414   Shishi_keyusage;
415 
416   typedef enum
417   {
418     /* No error */
419     SHISHI_KDC_ERR_NONE = 0,
420     /* Client's entry in database has expired */
421     SHISHI_KDC_ERR_NAME_EXP = 1,
422     /* Server's entry in database has expired */
423     SHISHI_KDC_ERR_SERVICE_EXP = 2,
424     /* Requested protocol version number  - not supported */
425     SHISHI_KDC_ERR_BAD_PVNO = 3,
426     /* Client's key encrypted in old master key */
427     SHISHI_KDC_ERR_C_OLD_MAST_KVNO = 4,
428     /* Server's key encrypted in old master key */
429     SHISHI_KDC_ERR_S_OLD_MAST_KVNO = 5,
430     /* Client not found in database */
431     SHISHI_KDC_ERR_C_PRINCIPAL_UNKNOWN = 6,
432     /* Server not found in database */
433     SHISHI_KDC_ERR_S_PRINCIPAL_UNKNOWN = 7,
434     /* Multiple principal entries in database */
435     SHISHI_KDC_ERR_PRINCIPAL_NOT_UNIQUE = 8,
436     /* The client or server has a null key */
437     SHISHI_KDC_ERR_NULL_KEY = 9,
438     /* Ticket not eligible for postdating */
439     SHISHI_KDC_ERR_CANNOT_POSTDATE = 10,
440     /* Requested start time is later than end time */
441     SHISHI_KDC_ERR_NEVER_VALID = 11,
442     /* KDC policy rejects request */
443     SHISHI_KDC_ERR_POLICY = 12,
444     /* KDC cannot accommodate requested option */
445     SHISHI_KDC_ERR_BADOPTION = 13,
446     /* KDC has no support for encryption type */
447     SHISHI_KDC_ERR_ETYPE_NOSUPP = 14,
448     /* KDC has no support for checksum type */
449     SHISHI_KDC_ERR_SUMTYPE_NOSUPP = 15,
450     /* KDC has no support for padata type */
451     SHISHI_KDC_ERR_PADATA_TYPE_NOSUPP = 16,
452     /* KDC has no support for transited type */
453     SHISHI_KDC_ERR_TRTYPE_NOSUPP = 17,
454     /* Clients credentials have been revoked */
455     SHISHI_KDC_ERR_CLIENT_REVOKED = 18,
456     /* Credentials for server have been revoked */
457     SHISHI_KDC_ERR_SERVICE_REVOKED = 19,
458     /* TGT has been revoked */
459     SHISHI_KDC_ERR_TGT_REVOKED = 20,
460     /* Client not yet valid - try again later */
461     SHISHI_KDC_ERR_CLIENT_NOTYET = 21,
462     /* Server not yet valid - try again later */
463     SHISHI_KDC_ERR_SERVICE_NOTYET = 22,
464     /* Password has expired - change password to reset */
465     SHISHI_KDC_ERR_KEY_EXPIRED = 23,
466     /* Pre-authentication information was invalid */
467     SHISHI_KDC_ERR_PREAUTH_FAILED = 24,
468     /* Additional pre-authenticationrequired */
469     SHISHI_KDC_ERR_PREAUTH_REQUIRED = 25,
470     /* Requested server and ticket don't match */
471     SHISHI_KDC_ERR_SERVER_NOMATCH = 26,
472     /* Server principal valid for user = 2,user only */
473     SHISHI_KDC_ERR_MUST_USE_USER2USER = 27,
474     /* KDC Policy rejects transited path */
475     SHISHI_KDC_ERR_PATH_NOT_ACCPETED = 28,
476     /* A service is not available */
477     SHISHI_KDC_ERR_SVC_UNAVAILABLE = 29,
478     /* Integrity check on decrypted field failed */
479     SHISHI_KRB_AP_ERR_BAD_INTEGRITY = 31,
480     /* Ticket expired */
481     SHISHI_KRB_AP_ERR_TKT_EXPIRED = 32,
482     /* Ticket not yet valid */
483     SHISHI_KRB_AP_ERR_TKT_NYV = 33,
484     /* Request is a replay */
485     SHISHI_KRB_AP_ERR_REPEAT = 34,
486     /* The ticket isn't for us */
487     SHISHI_KRB_AP_ERR_NOT_US = 35,
488     /* Ticket and authenticator don't match */
489     SHISHI_KRB_AP_ERR_BADMATCH = 36,
490     /* Clock skew too great */
491     SHISHI_KRB_AP_ERR_SKEW = 37,
492     /* Incorrect net address */
493     SHISHI_KRB_AP_ERR_BADADDR = 38,
494     /* Protocol version mismatch */
495     SHISHI_KRB_AP_ERR_BADVERSION = 39,
496     /* Invalid msg type */
497     SHISHI_KRB_AP_ERR_MSG_TYPE = 40,
498     /* Message stream modified */
499     SHISHI_KRB_AP_ERR_MODIFIED = 41,
500     /* Message out of order */
501     SHISHI_KRB_AP_ERR_BADORDER = 42,
502     /* Specified version of key is not available */
503     SHISHI_KRB_AP_ERR_BADKEYVER = 44,
504     /* Service key not available */
505     SHISHI_KRB_AP_ERR_NOKEY = 45,
506     /* Mutual authentication failed */
507     SHISHI_KRB_AP_ERR_MUT_FAIL = 46,
508     /* Incorrect message direction */
509     SHISHI_KRB_AP_ERR_BADDIRECTION = 47,
510     /* Alternative authentication method required */
511     SHISHI_KRB_AP_ERR_METHOD = 48,
512     /* Incorrect sequence number in message */
513     SHISHI_KRB_AP_ERR_BADSEQ = 49,
514     /* Inappropriate type of checksum in message */
515     SHISHI_KRB_AP_ERR_INAPP_CKSUM = 50,
516     /* Policy rejects transited path */
517     SHISHI_KRB_AP_PATH_NOT_ACCEPTED = 51,
518     /* Response too big for UDP, retry with TCP */
519     SHISHI_KRB_ERR_RESPONSE_TOO_BIG = 52,
520     /* Generic error (description in e-text) */
521     SHISHI_KRB_ERR_GENERIC = 60,
522     /* Field is too long for this implementation */
523     SHISHI_KRB_ERR_FIELD_TOOLONG = 61,
524     /* Reserved for PKINIT */
525     SHISHI_KDC_ERROR_CLIENT_NOT_TRUSTED = 62,
526     /* Reserved for PKINIT */
527     SHISHI_KDC_ERROR_KDC_NOT_TRUSTED = 63,
528     /* Reserved for PKINIT */
529     SHISHI_KDC_ERROR_INVALID_SIG = 64,
530     /* Reserved for PKINIT */
531     SHISHI_KDC_ERR_KEY_TOO_WEAK = 65,
532     /* Reserved for PKINIT */
533     SHISHI_KDC_ERR_CERTIFICATE_MISMATCH = 66,
534     /* No TGT available to validate USER-TO-USER */
535     SHISHI_KRB_AP_ERR_NO_TGT = 67,
536     /* USER-TO-USER TGT issued different KDC */
537     SHISHI_KDC_ERR_WRONG_REALM = 68,
538     /* Ticket must be for USER-TO-USER */
539     SHISHI_KRB_AP_ERR_USER_TO_USER_REQUIRED = 69,
540     /* Reserved for PKINIT */
541     SHISHI_KDC_ERR_CANT_VERIFY_CERTIFICATE = 70,
542     /* Reserved for PKINIT */
543     SHISHI_KDC_ERR_INVALID_CERTIFICATE = 71,
544     /* Reserved for PKINIT */
545     SHISHI_KDC_ERR_REVOKED_CERTIFICATE = 72,
546     /* Reserved for PKINIT */
547     SHISHI_KDC_ERR_REVOCATION_STATUS_UNKNOWN = 73,
548     /* Reserved for PKINIT */
549     SHISHI_KDC_ERR_REVOCATION_STATUS_UNAVAILABLE = 74,
550     /* Reserved for PKINIT */
551     SHISHI_KDC_ERR_CLIENT_NAME_MISMATCH = 75,
552     /* Reserved for PKINIT */
553     SHISHI_KDC_ERR_KDC_NAME_MISMATCH = 76,
554     SHISHI_LAST_ERROR_CODE = 76
555   }
556   Shishi_krb_error;
557 
558   typedef enum
559   {
560     SHISHI_TKTSHINTFLAGS_ACCEPT_EXPIRED = 1,
561     SHISHI_TKTSHINTFLAGS_NON_INTERACTIVE = 2
562   }
563   Shishi_tkts_hintflags;
564 
565   struct Shishi_tkts_hint
566   {
567     int startpos;
568     char *server;
569     char *serverrealm;
570     char *client;
571     char *clientrealm;
572     int flags;
573     Shishi_ticketflags tktflags;
574     Shishi_KDCOptions kdcoptions;
575     int32_t etype;
576     char *passwd;
577     time_t starttime;
578     time_t endtime;
579     time_t renew_till;
580     int32_t preauthetype;
581     char *preauthsalt;
582     size_t preauthsaltlen;
583     char *preauths2kparams;
584     size_t preauths2kparamslen;
585   };
586   typedef struct Shishi_tkts_hint Shishi_tkts_hint;
587 
588 /* resolv.c */
589 #define SHISHI_DNS_IN 1
590 #define SHISHI_DNS_TXT 16
591 #define SHISHI_DNS_SRV 33
592 
593   struct Shishi_dns_st
594   {
595     struct Shishi_dns_st *next;
596 
597     uint16_t class;
598     uint16_t type;
599     uint32_t ttl;
600 
601     void *rr;
602   };
603   typedef struct Shishi_dns_st *Shishi_dns;
604 
605   struct Shishi_dns_srv_st
606   {
607     uint16_t priority;
608     uint16_t weight;
609     uint16_t port;
610 
611     char name[256];
612   };
613   typedef struct Shishi_dns_srv_st *Shishi_dns_srv;
614 
615   typedef struct Shishi Shishi;
616   typedef struct Shishi_tkt Shishi_tkt;
617   typedef struct Shishi_tkts Shishi_tkts;
618   typedef struct Shishi_as Shishi_as;
619   typedef struct Shishi_tgs Shishi_tgs;
620   typedef struct Shishi_ap Shishi_ap;
621   typedef struct Shishi_key Shishi_key;
622   typedef struct Shishi_keys Shishi_keys;
623   typedef struct Shishi_safe Shishi_safe;
624   typedef struct Shishi_priv Shishi_priv;
625 #ifdef LIBTASN1_H
626   typedef ASN1_TYPE Shishi_asn1;
627 #else
628   typedef void *Shishi_asn1;
629 #endif
630   typedef struct Shishi_crypto Shishi_crypto;
631 
632 #define SHISHI_GENERALIZEDTIME_LENGTH 15
633 #define SHISHI_GENERALIZEDTIMEZ_LENGTH (SHISHI_GENERALIZEDTIME_LENGTH + 1)
634 
635 /* If non-NULL, call this function when memory is exhausted. */
636   extern void (*shishi_alloc_fail_function) (void);
637 
638 /* init.c */
639   extern Shishi *shishi (void);
640   extern Shishi *shishi_server (void);
641   extern void shishi_done (Shishi * handle);
642   extern int shishi_init (Shishi ** handle);
643   extern int shishi_init_with_paths (Shishi ** handle,
644 				     const char *tktsfile,
645 				     const char *systemcfgfile,
646 				     const char *usercfgfile);
647   extern int shishi_init_server (Shishi ** handle);
648   extern int shishi_init_server_with_paths (Shishi ** handle,
649 					    const char *systemcfgfile);
650 
651 /* cfg.c */
652   extern int shishi_cfg (Shishi * handle, const char *option);
653   extern int shishi_cfg_from_file (Shishi * handle, const char *cfg);
654   extern int shishi_cfg_print (Shishi * handle, FILE * fh);
655   extern const char *shishi_cfg_default_systemfile (Shishi * handle);
656   extern const char *shishi_cfg_default_userdirectory (Shishi * handle);
657   extern const char *shishi_cfg_default_userfile (Shishi * handle);
658   extern char *shishi_cfg_userdirectory_file (Shishi * handle,
659 					      const char *file);
660   extern int shishi_cfg_clientkdcetype (Shishi * handle, int32_t ** etypes);
661   extern int32_t shishi_cfg_clientkdcetype_fast (Shishi * handle);
662   extern int shishi_cfg_clientkdcetype_set (Shishi * handle, char *value);
663   extern int shishi_cfg_authorizationtype_set (Shishi * handle, char *value);
664 
665 /* error.c */
666   extern const char *shishi_strerror (int err);
667   extern const char *shishi_error (Shishi * handle);
668   extern void shishi_error_clear (Shishi * handle);
669   extern void shishi_error_set (Shishi * handle, const char *errstr);
670   extern void shishi_error_printf (Shishi * handle, const char *format, ...)
671     __attribute__ ((format (printf, 2, 3)));
672   extern int shishi_error_outputtype (Shishi * handle);
673   extern void shishi_error_set_outputtype (Shishi * handle, int type);
674   extern void shishi_info (Shishi * handle, const char *format, ...)
675     __attribute__ ((format (printf, 2, 3)));
676   extern void shishi_warn (Shishi * handle, const char *format, ...)
677     __attribute__ ((format (printf, 2, 3)));
678   extern void shishi_verbose (Shishi * handle, const char *format, ...)
679     __attribute__ ((format (printf, 2, 3)));
680 
681 /* realm.c */
682   extern char *shishi_realm_default_guess (void);
683   extern const char *shishi_realm_default (Shishi * handle);
684   extern void shishi_realm_default_set (Shishi * handle, const char *realm);
685   extern char *shishi_realm_for_server_file (Shishi * handle, char *server);
686   extern char *shishi_realm_for_server_dns (Shishi * handle, char *server);
687   extern char *shishi_realm_for_server (Shishi * handle, char *server);
688 
689 /* principal.c */
690   extern char *shishi_principal_default_guess (void);
691   extern const char *shishi_principal_default (Shishi * handle);
692   extern void shishi_principal_default_set (Shishi * handle,
693 					    const char *principal);
694   extern int shishi_principal_name (Shishi * handle,
695 				    Shishi_asn1 namenode,
696 				    const char *namefield,
697 				    char **out, size_t * outlen);
698   extern int shishi_principal_name_realm (Shishi * handle,
699 					  Shishi_asn1 namenode,
700 					  const char *namefield,
701 					  Shishi_asn1 realmnode,
702 					  const char *realmfield,
703 					  char **out, size_t * outlen);
704   extern int shishi_principal_name_set (Shishi * handle,
705 					Shishi_asn1 namenode,
706 					const char *namefield,
707 					Shishi_name_type name_type,
708 					const char *name[]);
709   extern int shishi_principal_set (Shishi * handle,
710 				   Shishi_asn1 namenode,
711 				   const char *namefield, const char *name);
712   extern int shishi_parse_name (Shishi * handle, const char *name,
713 				char **principal, char **realm);
714   extern int shishi_derive_default_salt (Shishi * handle,
715 					 const char *name, char **salt);
716   extern char *shishi_server_for_local_service (Shishi * handle,
717 						const char *service);
718 
719 /* ticket.c */
720   extern Shishi_asn1 shishi_ticket (Shishi * handle);
721   extern int shishi_ticket_server (Shishi * handle, Shishi_asn1 ticket,
722 				   char **server, size_t * serverlen);
723   extern int shishi_ticket_sname_set (Shishi * handle,
724 				      Shishi_asn1 ticket,
725 				      Shishi_name_type name_type,
726 				      char *sname[]);
727   extern int shishi_ticket_srealmserver_set (Shishi * handle,
728 					     Shishi_asn1 ticket,
729 					     const char *realm,
730 					     const char *server);
731   extern int shishi_ticket_set_server (Shishi * handle, Shishi_asn1 ticket,
732 				       const char *server);
733   extern int shishi_ticket_realm_get (Shishi * handle,
734 				      Shishi_asn1 ticket,
735 				      char **realm, size_t * realmlen);
736   extern int shishi_ticket_realm_set (Shishi * handle, Shishi_asn1 ticket,
737 				      const char *realm);
738   extern int shishi_ticket_get_enc_part_etype (Shishi * handle,
739 					       Shishi_asn1 ticket,
740 					       int32_t * etype);
741   extern int shishi_ticket_set_enc_part (Shishi * handle, Shishi_asn1 ticket,
742 					 int32_t etype, uint32_t kvno,
743 					 const char *buf, size_t buflen);
744   extern int shishi_ticket_add_enc_part (Shishi * handle, Shishi_asn1 ticket,
745 					 Shishi_key * key,
746 					 Shishi_asn1 encticketpart);
747   extern int shishi_ticket_decrypt (Shishi * handle, Shishi_asn1 ticket,
748 				    Shishi_key * key,
749 				    Shishi_asn1 * encticketpart);
750 
751 /* tkt.c */
752   extern Shishi_asn1 shishi_tkt_ticket (Shishi_tkt * tkt);
753   extern void shishi_tkt_ticket_set (Shishi_tkt * tkt, Shishi_asn1 ticket);
754   extern Shishi_asn1 shishi_tkt_kdcrep (Shishi_tkt * tkt);
755   extern Shishi_asn1 shishi_tkt_enckdcreppart (Shishi_tkt * tkt);
756   extern void shishi_tkt_enckdcreppart_set (Shishi_tkt * tkt,
757 					    Shishi_asn1 enckdcreppart);
758   extern Shishi_asn1 shishi_tkt_encticketpart (Shishi_tkt * tkt);
759   extern void shishi_tkt_encticketpart_set (Shishi_tkt * tkt,
760 					    Shishi_asn1 encticketpart);
761   extern Shishi_key *shishi_tkt_key (Shishi_tkt * tkt);
762   extern int shishi_tkt_key_set (Shishi_tkt * tkt, Shishi_key * key);
763   extern int shishi_tkt (Shishi * handle, Shishi_tkt ** tkt);
764   extern Shishi_tkt *shishi_tkt2 (Shishi * handle,
765 				  Shishi_asn1 ticket,
766 				  Shishi_asn1 enckdcreppart,
767 				  Shishi_asn1 kdcrep);
768   extern void shishi_tkt_pretty_print (Shishi_tkt * tkt, FILE * fh);
769   extern int shishi_tkt_realm (Shishi_tkt * tkt, char **realm,
770 			       size_t * realmlen);
771   extern int shishi_tkt_client (Shishi_tkt * tkt,
772 				char **client, size_t * clientlen);
773   extern int shishi_tkt_client_p (Shishi_tkt * tkt, const char *client);
774   extern int shishi_tkt_clientrealm (Shishi_tkt * tkt,
775 				     char **client, size_t * clientlen);
776   extern int shishi_tkt_clientrealm_p (Shishi_tkt * tkt, const char *client);
777   extern int shishi_tkt_clientrealm_set (Shishi_tkt * tkt,
778 					 const char *realm,
779 					 const char *client);
780   extern int shishi_tkt_serverrealm_set (Shishi_tkt * tkt, const char *realm,
781 					 const char *server);
782   extern int shishi_tkt_build (Shishi_tkt * tkt, Shishi_key * key);
783   extern int shishi_tkt_lastreq (Shishi_tkt * tkt,
784 				 char **lrtime, size_t * lrtimelen,
785 				 int32_t lrtype);
786   extern time_t shishi_tkt_lastreqc (Shishi_tkt * tkt, Shishi_lrtype lrtype);
787   extern void shishi_tkt_lastreq_pretty_print (Shishi_tkt * tkt, FILE * fh);
788   extern int shishi_tkt_authtime (Shishi_tkt * tkt,
789 				  char **authtime, size_t * authtimelen);
790   extern time_t shishi_tkt_authctime (Shishi_tkt * tkt);
791   extern int shishi_tkt_starttime (Shishi_tkt * tkt,
792 				   char **starttime, size_t * starttimelen);
793   extern time_t shishi_tkt_startctime (Shishi_tkt * tkt);
794   extern int shishi_tkt_endtime (Shishi_tkt * tkt,
795 				 char **endtime, size_t * endtimelen);
796   extern time_t shishi_tkt_endctime (Shishi_tkt * tkt);
797   extern int shishi_tkt_renew_till (Shishi_tkt * tkt,
798 				    char **renewtilltime,
799 				    size_t * renewtilllen);
800   extern time_t shishi_tkt_renew_tillc (Shishi_tkt * tkt);
801   extern int shishi_tkt_keytype (Shishi_tkt * tkt, int32_t * etype);
802   extern int32_t shishi_tkt_keytype_fast (Shishi_tkt * tkt);
803   extern int shishi_tkt_keytype_p (Shishi_tkt * tkt, int32_t etype);
804   extern int shishi_tkt_server (Shishi_tkt * tkt,
805 				char **server, size_t * serverlen);
806   extern int shishi_tkt_server_p (Shishi_tkt * tkt, const char *server);
807   extern int shishi_tkt_valid_at_time_p (Shishi_tkt * tkt, time_t now);
808   extern int shishi_tkt_valid_now_p (Shishi_tkt * tkt);
809   extern int shishi_tkt_expired_p (Shishi_tkt * tkt);
810   extern int shishi_tkt_decrypt (Shishi_tkt * tkt, Shishi_key * key);
811   extern void shishi_tkt_done (Shishi_tkt * tkt);
812   extern int shishi_tkt_flags (Shishi_tkt * tkt, uint32_t * flags);
813   extern int shishi_tkt_flags_set (Shishi_tkt * tkt, uint32_t flags);
814   extern int shishi_tkt_flags_add (Shishi_tkt * tkt, uint32_t flag);
815   extern int shishi_tkt_forwardable_p (Shishi_tkt * tkt);
816   extern int shishi_tkt_forwarded_p (Shishi_tkt * tkt);
817   extern int shishi_tkt_proxiable_p (Shishi_tkt * tkt);
818   extern int shishi_tkt_proxy_p (Shishi_tkt * tkt);
819   extern int shishi_tkt_may_postdate_p (Shishi_tkt * tkt);
820   extern int shishi_tkt_postdated_p (Shishi_tkt * tkt);
821   extern int shishi_tkt_invalid_p (Shishi_tkt * tkt);
822   extern int shishi_tkt_renewable_p (Shishi_tkt * tkt);
823   extern int shishi_tkt_initial_p (Shishi_tkt * tkt);
824   extern int shishi_tkt_pre_authent_p (Shishi_tkt * tkt);
825   extern int shishi_tkt_hw_authent_p (Shishi_tkt * tkt);
826   extern int shishi_tkt_transited_policy_checked_p (Shishi_tkt * tkt);
827   extern int shishi_tkt_ok_as_delegate_p (Shishi_tkt * tkt);
828 
829 /* tkts.c */
830   extern char *shishi_tkts_default_file_guess (Shishi * handle);
831   extern const char *shishi_tkts_default_file (Shishi * handle);
832   extern void shishi_tkts_default_file_set (Shishi * handle,
833 					    const char *tktsfile);
834   extern Shishi_tkts *shishi_tkts_default (Shishi * handle);
835   extern int shishi_tkts_default_to_file (Shishi_tkts * tkts);
836   extern int shishi_tkts (Shishi * handle, Shishi_tkts ** tkts);
837   extern Shishi_tkt *shishi_tkts_nth (Shishi_tkts * tkts, int ticketno);
838   extern int shishi_tkts_size (Shishi_tkts * tkts);
839   extern int shishi_tkts_add (Shishi_tkts * tkts, Shishi_tkt * tkt);
840   extern int shishi_tkts_new (Shishi_tkts * tkts,
841 			      Shishi_asn1 ticket,
842 			      Shishi_asn1 enckdcreppart, Shishi_asn1 kdcrep);
843   extern int shishi_tkts_remove (Shishi_tkts * tkts, int ticketno);
844   extern int shishi_tkts_expire (Shishi_tkts * tkts);
845   extern int shishi_tkts_print_for_service (Shishi_tkts * tkts,
846 					    FILE * fh, const char *service);
847   extern int shishi_tkts_print (Shishi_tkts * tkts, FILE * fh);
848   extern int shishi_tkts_write (Shishi_tkts * tkts, FILE * fh);
849   extern int shishi_tkts_to_file (Shishi_tkts * tkts, const char *filename);
850   extern int shishi_tkts_read (Shishi_tkts * tkts, FILE * fh);
851   extern int shishi_tkts_from_file (Shishi_tkts * tkts, const char *filename);
852   extern void shishi_tkts_done (Shishi_tkts ** tkts);
853   extern int shishi_tkt_match_p (Shishi_tkt * tkt, Shishi_tkts_hint * hint);
854   extern Shishi_tkt *shishi_tkts_find (Shishi_tkts * tkts,
855 				       Shishi_tkts_hint * hint);
856   extern Shishi_tkt *shishi_tkts_find_for_clientserver (Shishi_tkts * tkts,
857 							const char *client,
858 							const char *server);
859   extern Shishi_tkt *shishi_tkts_find_for_server (Shishi_tkts * tkts,
860 						  const char *server);
861   extern Shishi_tkt *shishi_tkts_get (Shishi_tkts * tkts,
862 				      Shishi_tkts_hint * hint);
863   extern Shishi_tkt *shishi_tkts_get_tgt (Shishi_tkts * tkts,
864 					  Shishi_tkts_hint * hint);
865   extern Shishi_tkt *shishi_tkts_get_tgs (Shishi_tkts * tkts,
866 					  Shishi_tkts_hint * hint,
867 					  Shishi_tkt * tgt);
868   extern Shishi_tkt *shishi_tkts_get_for_clientserver (Shishi_tkts * tkts,
869 						       const char *client,
870 						       const char *server);
871   extern Shishi_tkt *shishi_tkts_get_for_server (Shishi_tkts * tkts,
872 						 const char *server);
873   extern Shishi_tkt *shishi_tkts_get_for_localservicepasswd (Shishi_tkts *
874 							     tkts,
875 							     const char
876 							     *service,
877 							     const char
878 							     *passwd);
879 
880 /* tktccache.c */
881   extern char *shishi_tkts_default_ccache_guess (Shishi * handle);
882   extern const char *shishi_tkts_default_ccache (Shishi * handle);
883   extern void shishi_tkts_default_ccache_set (Shishi * handle,
884 					      const char *ccache);
885   extern int shishi_tkts_add_ccache_mem (Shishi * handle,
886 					 const char *data, size_t len,
887 					 Shishi_tkts * tkts);
888   extern int shishi_tkts_add_ccache_file (Shishi * handle,
889 					  const char *filename,
890 					  Shishi_tkts * tkts);
891   extern int shishi_tkts_from_ccache_mem (Shishi * handle,
892 					  const char *data, size_t len,
893 					  Shishi_tkts ** outtkts);
894   extern int shishi_tkts_from_ccache_file (Shishi * handle,
895 					   const char *filename,
896 					   Shishi_tkts ** outtkts);
897 
898 /* diskio.c */
899   extern int
900     shishi_enckdcreppart_print (Shishi * handle,
901 				FILE * fh, Shishi_asn1 enckdcreppart);
902   extern int
903     shishi_enckdcreppart_save (Shishi * handle,
904 			       FILE * fh, Shishi_asn1 enckdcreppart);
905   extern int
906     shishi_enckdcreppart_parse (Shishi * handle,
907 				FILE * fh, Shishi_asn1 * enckdcreppart);
908   extern int
909     shishi_enckdcreppart_read (Shishi * handle,
910 			       FILE * fh, Shishi_asn1 * enckdcreppart);
911   extern int shishi_ticket_save (Shishi * handle, FILE * fh,
912 				 Shishi_asn1 ticket);
913   extern int shishi_ticket_print (Shishi * handle, FILE * fh,
914 				  Shishi_asn1 ticket);
915   extern int shishi_kdc_print (Shishi * handle, FILE * fh, Shishi_asn1 asreq,
916 			       Shishi_asn1 asrep, Shishi_asn1 encasreppart);
917   extern int shishi_ticket_parse (Shishi * handle, FILE * fh,
918 				  Shishi_asn1 * ticket);
919   extern int shishi_ticket_read (Shishi * handle, FILE * fh,
920 				 Shishi_asn1 * ticket);
921   extern int shishi_etype_info_print (Shishi * handle, FILE * fh,
922 				      Shishi_asn1 etypeinfo);
923   extern int shishi_etype_info2_print (Shishi * handle, FILE * fh,
924 				       Shishi_asn1 etypeinfo2);
925   extern int shishi_padata_print (Shishi * handle, FILE * fh,
926 				  Shishi_asn1 padata);
927   extern int shishi_methoddata_print (Shishi * handle, FILE * fh,
928 				      Shishi_asn1 methoddata);
929 
930 /* authenticator.c */
931   extern Shishi_asn1 shishi_authenticator (Shishi * handle);
932   extern int shishi_authenticator_set_crealm (Shishi * handle,
933 					      Shishi_asn1 authenticator,
934 					      const char *crealm);
935   extern int shishi_authenticator_set_cname (Shishi * handle,
936 					     Shishi_asn1 authenticator,
937 					     Shishi_name_type name_type,
938 					     const char *cname[]);
939   extern int shishi_authenticator_client_set (Shishi * handle,
940 					      Shishi_asn1 authenticator,
941 					      const char *client);
942   extern int shishi_authenticator_ctime (Shishi * handle,
943 					 Shishi_asn1 authenticator, char **t);
944   extern int shishi_authenticator_ctime_set (Shishi * handle,
945 					     Shishi_asn1 authenticator,
946 					     const char *t);
947   extern int shishi_authenticator_cusec_get (Shishi * handle,
948 					     Shishi_asn1 authenticator,
949 					     uint32_t * cusec);
950   extern int shishi_authenticator_cusec_set (Shishi * handle,
951 					     Shishi_asn1 authenticator,
952 					     uint32_t cusec);
953   extern int shishi_authenticator_seqnumber_get (Shishi * handle,
954 						 Shishi_asn1 authenticator,
955 						 uint32_t * seqnumber);
956   extern int shishi_authenticator_seqnumber_remove (Shishi * handle,
957 						    Shishi_asn1
958 						    authenticator);
959   extern int shishi_authenticator_seqnumber_set (Shishi * handle,
960 						 Shishi_asn1 authenticator,
961 						 uint32_t seqnumber);
962   extern int shishi_authenticator_client (Shishi * handle,
963 					  Shishi_asn1 authenticator,
964 					  char **client, size_t * clientlen);
965   extern int shishi_authenticator_clientrealm (Shishi * handle,
966 					       Shishi_asn1 authenticator,
967 					       char **client,
968 					       size_t * clientlen);
969   extern int shishi_authenticator_remove_cksum (Shishi * handle,
970 						Shishi_asn1 authenticator);
971   extern int shishi_authenticator_cksum (Shishi * handle,
972 					 Shishi_asn1 authenticator,
973 					 int32_t * cksumtype, char **cksum,
974 					 size_t * cksumlen);
975   extern int shishi_authenticator_set_cksum (Shishi * handle,
976 					     Shishi_asn1 authenticator,
977 					     int cksumtype, char *cksum,
978 					     size_t cksumlen);
979   extern int shishi_authenticator_add_cksum (Shishi * handle,
980 					     Shishi_asn1 authenticator,
981 					     Shishi_key * key, int keyusage,
982 					     char *data, size_t datalen);
983   extern int shishi_authenticator_add_cksum_type (Shishi * handle,
984 						  Shishi_asn1 authenticator,
985 						  Shishi_key * key,
986 						  int keyusage, int cksumtype,
987 						  char *data, size_t datalen);
988   extern int shishi_authenticator_remove_subkey (Shishi * handle,
989 						 Shishi_asn1 authenticator);
990   extern Shishi_asn1 shishi_authenticator_subkey (Shishi * handle);
991   extern int
992     shishi_authenticator_get_subkey (Shishi * handle,
993 				     Shishi_asn1 authenticator,
994 				     Shishi_key ** subkey);
995   extern int
996     shishi_authenticator_set_subkey (Shishi * handle,
997 				     Shishi_asn1 authenticator,
998 				     int32_t subkeytype,
999 				     const char *subkey, size_t subkeylen);
1000   extern int
1001     shishi_authenticator_add_random_subkey (Shishi * handle,
1002 					    Shishi_asn1 authenticator);
1003   extern int
1004     shishi_authenticator_add_random_subkey_etype (Shishi * handle,
1005 						  Shishi_asn1 authenticator,
1006 						  int etype);
1007   extern int
1008     shishi_authenticator_add_subkey (Shishi * handle,
1009 				     Shishi_asn1 authenticator,
1010 				     Shishi_key * subkey);
1011   extern int
1012     shishi_authenticator_clear_authorizationdata (Shishi * handle,
1013 						  Shishi_asn1 authenticator);
1014   extern int
1015     shishi_authenticator_add_authorizationdata (Shishi * handle,
1016 						Shishi_asn1 authenticator,
1017 						int32_t adtype,
1018 						const char *addata,
1019 						size_t addatalen);
1020   extern int
1021     shishi_authenticator_authorizationdata (Shishi * handle,
1022 					    Shishi_asn1 authenticator,
1023 					    int32_t * adtype,
1024 					    char **addata, size_t * addatalen,
1025 					    size_t nth);
1026   extern int shishi_authenticator_read (Shishi * handle, FILE * fh,
1027 					Shishi_asn1 * authenticator);
1028   extern int shishi_authenticator_parse (Shishi * handle, FILE * fh,
1029 					 Shishi_asn1 * authenticator);
1030   extern int shishi_authenticator_from_file (Shishi * handle,
1031 					     Shishi_asn1 * authenticator,
1032 					     int filetype,
1033 					     const char *filename);
1034   extern int shishi_authenticator_print (Shishi * handle, FILE * fh,
1035 					 Shishi_asn1 authenticator);
1036   extern int shishi_authenticator_to_file (Shishi * handle,
1037 					   Shishi_asn1 authenticator,
1038 					   int filetype,
1039 					   const char *filename);
1040   extern int shishi_authenticator_save (Shishi * handle, FILE * fh,
1041 					Shishi_asn1 authenticator);
1042 
1043 /* as.c */
1044   extern int shishi_as (Shishi * handle, Shishi_as ** as);
1045   extern void shishi_as_done (Shishi_as * as);
1046   extern Shishi_asn1 shishi_as_req (Shishi_as * as);
1047   extern int shishi_as_req_build (Shishi_as * as);
1048   extern void shishi_as_req_set (Shishi_as * as, Shishi_asn1 asreq);
1049   extern int shishi_as_req_der (Shishi_as * as, char **out, size_t * outlen);
1050   extern int shishi_as_req_der_set (Shishi_as * as, char *der, size_t derlen);
1051   extern Shishi_asn1 shishi_as_rep (Shishi_as * as);
1052   extern void shishi_as_rep_set (Shishi_as * as, Shishi_asn1 asrep);
1053   extern int shishi_as_rep_build (Shishi_as * as, Shishi_key * key);
1054   extern int shishi_as_rep_der (Shishi_as * as, char **out, size_t * outlen);
1055   extern int shishi_as_rep_der_set (Shishi_as * as, char *der, size_t derlen);
1056   extern Shishi_asn1 shishi_as_krberror (Shishi_as * as);
1057   extern int shishi_as_krberror_der (Shishi_as * as, char **out,
1058 				     size_t * outlen);
1059   extern void shishi_as_krberror_set (Shishi_as * as, Shishi_asn1 krberror);
1060   extern Shishi_tkt *shishi_as_tkt (Shishi_as * as);
1061   extern void shishi_as_tkt_set (Shishi_as * as, Shishi_tkt * tkt);
1062   extern int shishi_as_sendrecv (Shishi_as * as);
1063   extern int shishi_as_sendrecv_hint (Shishi_as * as,
1064 				      Shishi_tkts_hint * hint);
1065   extern int shishi_as_rep_process (Shishi_as * as, Shishi_key * key,
1066 				    const char *password);
1067 
1068 /* tgs.c */
1069   extern int shishi_tgs (Shishi * handle, Shishi_tgs ** tgs);
1070   extern void shishi_tgs_done (Shishi_tgs * tgs);
1071   extern Shishi_tkt *shishi_tgs_tgtkt (Shishi_tgs * tgs);
1072   extern void shishi_tgs_tgtkt_set (Shishi_tgs * tgs, Shishi_tkt * tgtkt);
1073   extern Shishi_ap *shishi_tgs_ap (Shishi_tgs * tgs);
1074   extern Shishi_asn1 shishi_tgs_req (Shishi_tgs * tgs);
1075   extern int shishi_tgs_req_der (Shishi_tgs * tgs, char **out,
1076 				 size_t * outlen);
1077   extern int shishi_tgs_req_der_set (Shishi_tgs * tgs, char *der,
1078 				     size_t derlen);
1079   extern void shishi_tgs_req_set (Shishi_tgs * tgs, Shishi_asn1 tgsreq);
1080   extern int shishi_tgs_req_build (Shishi_tgs * tgs);
1081   extern int shishi_tgs_req_process (Shishi_tgs * tgs);
1082   extern Shishi_asn1 shishi_tgs_rep (Shishi_tgs * tgs);
1083   extern int shishi_tgs_rep_der (Shishi_tgs * tgs, char **out,
1084 				 size_t * outlen);
1085   extern int shishi_tgs_rep_build (Shishi_tgs * tgs, int keyusage,
1086 				   Shishi_key * key);
1087   extern int shishi_tgs_rep_process (Shishi_tgs * tgs);
1088   extern Shishi_asn1 shishi_tgs_krberror (Shishi_tgs * tgs);
1089   extern int shishi_tgs_krberror_der (Shishi_tgs * tgs, char **out,
1090 				      size_t * outlen);
1091   extern void shishi_tgs_krberror_set (Shishi_tgs * tgs,
1092 				       Shishi_asn1 krberror);
1093   extern Shishi_tkt *shishi_tgs_tkt (Shishi_tgs * tgs);
1094   extern void shishi_tgs_tkt_set (Shishi_tgs * tgs, Shishi_tkt * tkt);
1095   extern int shishi_tgs_sendrecv (Shishi_tgs * tgs);
1096   extern int shishi_tgs_sendrecv_hint (Shishi_tgs * tgs,
1097 				       Shishi_tkts_hint * hint);
1098   extern int shishi_tgs_set_server (Shishi_tgs * tgs, const char *server);
1099   extern int shishi_tgs_set_realm (Shishi_tgs * tgs, const char *realm);
1100   extern int shishi_tgs_set_realmserver (Shishi_tgs * tgs,
1101 					 const char *realm,
1102 					 const char *server);
1103 
1104 /* kdcreq.c */
1105   extern int shishi_kdcreq (Shishi * handle, char *realm,
1106 			    char *service, Shishi_asn1 * req);
1107   extern Shishi_asn1 shishi_asreq (Shishi * handle);
1108   extern Shishi_asn1 shishi_asreq_rsc (Shishi * handle, char *realm,
1109 				       char *server, char *client);
1110   extern Shishi_asn1 shishi_tgsreq (Shishi * handle);
1111   extern Shishi_asn1 shishi_tgsreq_rst (Shishi * handle, char *realm,
1112 					char *server, Shishi_tkt * tkt);
1113   extern int shishi_kdcreq_save (Shishi * handle, FILE * fh,
1114 				 Shishi_asn1 kdcreq);
1115   extern int shishi_kdcreq_print (Shishi * handle, FILE * fh,
1116 				  Shishi_asn1 kdcreq);
1117   extern int shishi_kdcreq_to_file (Shishi * handle, Shishi_asn1 kdcreq,
1118 				    int filetype, const char *filename);
1119   extern int shishi_kdcreq_parse (Shishi * handle, FILE * fh,
1120 				  Shishi_asn1 * kdcreq);
1121   extern int shishi_kdcreq_read (Shishi * handle, FILE * fh,
1122 				 Shishi_asn1 * kdcreq);
1123   extern int shishi_kdcreq_from_file (Shishi * handle, Shishi_asn1 * kdcreq,
1124 				      int filetype, const char *filename);
1125   extern int shishi_asreq_clientrealm (Shishi * handle,
1126 				       Shishi_asn1 asreq,
1127 				       char **client, size_t * clientlen);
1128   extern int shishi_kdcreq_nonce (Shishi * handle, Shishi_asn1 kdcreq,
1129 				  uint32_t * nonce);
1130   extern int shishi_kdcreq_nonce_set (Shishi * handle,
1131 				      Shishi_asn1 kdcreq, uint32_t nonce);
1132   extern int shishi_kdcreq_client (Shishi * handle, Shishi_asn1 kdcreq,
1133 				   char **client, size_t * clientlen);
1134   extern int shishi_kdcreq_set_cname (Shishi * handle, Shishi_asn1 kdcreq,
1135 				      Shishi_name_type name_type,
1136 				      const char *principal);
1137   extern int shishi_kdcreq_server (Shishi * handle, Shishi_asn1 kdcreq,
1138 				   char **server, size_t * serverlen);
1139   extern int shishi_kdcreq_set_sname (Shishi * handle, Shishi_asn1 kdcreq,
1140 				      Shishi_name_type name_type,
1141 				      const char *sname[]);
1142   extern int shishi_kdcreq_realm (Shishi * handle, Shishi_asn1 kdcreq,
1143 				  char **realm, size_t * realmlen);
1144   extern int shishi_kdcreq_realm_get (Shishi * handle, Shishi_asn1 kdcreq,
1145 				      char **realm, size_t * realmlen);
1146   extern int shishi_kdcreq_set_realm (Shishi * handle, Shishi_asn1 kdcreq,
1147 				      const char *realm);
1148   extern int shishi_kdcreq_set_server (Shishi * handle, Shishi_asn1 req,
1149 				       const char *service);
1150   extern int shishi_kdcreq_set_realmserver (Shishi * handle, Shishi_asn1 req,
1151 					    char *realm, char *service);
1152   extern int shishi_kdcreq_till (Shishi * handle, Shishi_asn1 kdcreq,
1153 				 char **till, size_t * tilllen);
1154   extern time_t shishi_kdcreq_tillc (Shishi * handle, Shishi_asn1 kdcreq);
1155   extern int shishi_kdcreq_etype (Shishi * handle, Shishi_asn1 kdcreq,
1156 				  int32_t * etype, int netype);
1157   extern int shishi_kdcreq_set_etype (Shishi * handle, Shishi_asn1 kdcreq,
1158 				      int32_t * etype, int netype);
1159   extern int shishi_kdcreq_options (Shishi * handle, Shishi_asn1 kdcreq,
1160 				    uint32_t * flags);
1161   extern int shishi_kdcreq_forwardable_p (Shishi * handle,
1162 					  Shishi_asn1 kdcreq);
1163   extern int shishi_kdcreq_forwarded_p (Shishi * handle, Shishi_asn1 kdcreq);
1164   extern int shishi_kdcreq_proxiable_p (Shishi * handle, Shishi_asn1 kdcreq);
1165   extern int shishi_kdcreq_proxy_p (Shishi * handle, Shishi_asn1 kdcreq);
1166   extern int shishi_kdcreq_allow_postdate_p (Shishi * handle,
1167 					     Shishi_asn1 kdcreq);
1168   extern int shishi_kdcreq_postdated_p (Shishi * handle, Shishi_asn1 kdcreq);
1169   extern int shishi_kdcreq_renewable_p (Shishi * handle, Shishi_asn1 kdcreq);
1170   extern int shishi_kdcreq_disable_transited_check_p (Shishi * handle,
1171 						      Shishi_asn1 kdcreq);
1172   extern int shishi_kdcreq_renewable_ok_p (Shishi * handle,
1173 					   Shishi_asn1 kdcreq);
1174   extern int shishi_kdcreq_enc_tkt_in_skey_p (Shishi * handle,
1175 					      Shishi_asn1 kdcreq);
1176   extern int shishi_kdcreq_renew_p (Shishi * handle, Shishi_asn1 kdcreq);
1177   extern int shishi_kdcreq_validate_p (Shishi * handle, Shishi_asn1 kdcreq);
1178   extern int shishi_kdcreq_options_set (Shishi * handle, Shishi_asn1 kdcreq,
1179 					uint32_t options);
1180   extern int shishi_kdcreq_options_add (Shishi * handle, Shishi_asn1 kdcreq,
1181 					uint32_t option);
1182   extern int shishi_kdcreq_clear_padata (Shishi * handle, Shishi_asn1 kdcreq);
1183   extern int shishi_kdcreq_get_padata (Shishi * handle,
1184 				       Shishi_asn1 kdcreq,
1185 				       Shishi_padata_type padatatype,
1186 				       char **out, size_t * outlen);
1187   extern int shishi_kdcreq_get_padata_tgs (Shishi * handle,
1188 					   Shishi_asn1 kdcreq,
1189 					   Shishi_asn1 * apreq);
1190   extern int shishi_kdcreq_add_padata (Shishi * handle,
1191 				       Shishi_asn1 kdcreq,
1192 				       int padatatype,
1193 				       const char *data, size_t datalen);
1194   extern int shishi_kdcreq_add_padata_tgs (Shishi * handle,
1195 					   Shishi_asn1 kdcreq,
1196 					   Shishi_asn1 apreq);
1197   extern int shishi_kdcreq_add_padata_preauth (Shishi * handle,
1198 					       Shishi_asn1 kdcreq,
1199 					       Shishi_key * key);
1200   extern int shishi_kdcreq_build (Shishi * handle, Shishi_asn1 kdcreq);
1201 
1202 /* kdc.c */
1203   extern int shishi_as_derive_salt (Shishi * handle,
1204 				    Shishi_asn1 asreq,
1205 				    Shishi_asn1 asrep,
1206 				    char **salt, size_t * saltlen);
1207   extern int shishi_tgs_process (Shishi * handle,
1208 				 Shishi_asn1 tgsreq,
1209 				 Shishi_asn1 tgsrep,
1210 				 Shishi_asn1 authenticator,
1211 				 Shishi_asn1 oldenckdcreppart,
1212 				 Shishi_asn1 * enckdcreppart);
1213   extern int shishi_as_process (Shishi * handle, Shishi_asn1 asreq,
1214 				Shishi_asn1 asrep,
1215 				const char *string,
1216 				Shishi_asn1 * enckdcreppart);
1217   extern int shishi_kdc_process (Shishi * handle, Shishi_asn1 kdcreq,
1218 				 Shishi_asn1 kdcrep, Shishi_key * key,
1219 				 int keyusage, Shishi_asn1 * enckdcreppart);
1220   extern int shishi_kdcreq_sendrecv (Shishi * handle, Shishi_asn1 kdcreq,
1221 				     Shishi_asn1 * kdcrep);
1222   extern int shishi_kdcreq_sendrecv_hint (Shishi * handle,
1223 					  Shishi_asn1 kdcreq,
1224 					  Shishi_asn1 * kdcrep,
1225 					  Shishi_tkts_hint * hint);
1226   extern int shishi_kdc_copy_crealm (Shishi * handle, Shishi_asn1 kdcrep,
1227 				     Shishi_asn1 encticketpart);
1228   extern int shishi_as_check_crealm (Shishi * handle, Shishi_asn1 asreq,
1229 				     Shishi_asn1 asrep);
1230   extern int shishi_kdc_copy_cname (Shishi * handle, Shishi_asn1 kdcrep,
1231 				    Shishi_asn1 encticketpart);
1232   extern int shishi_as_check_cname (Shishi * handle, Shishi_asn1 asreq,
1233 				    Shishi_asn1 asrep);
1234   extern int shishi_kdc_copy_nonce (Shishi * handle, Shishi_asn1 kdcreq,
1235 				    Shishi_asn1 enckdcreppart);
1236   extern int shishi_kdc_check_nonce (Shishi * handle, Shishi_asn1 kdcreq,
1237 				     Shishi_asn1 enckdcreppart);
1238 
1239 /* kdcrep.c */
1240   extern Shishi_asn1 shishi_asrep (Shishi * handle);
1241   extern Shishi_asn1 shishi_tgsrep (Shishi * handle);
1242   extern int shishi_kdcrep_save (Shishi * handle, FILE * fh,
1243 				 Shishi_asn1 kdcrep);
1244   extern int shishi_kdcrep_print (Shishi * handle, FILE * fh,
1245 				  Shishi_asn1 kdcrep);
1246   extern int shishi_kdcrep_to_file (Shishi * handle, Shishi_asn1 kdcrep,
1247 				    int filetype, const char *filename);
1248   extern int shishi_kdcrep_parse (Shishi * handle, FILE * fh,
1249 				  Shishi_asn1 * kdcrep);
1250   extern int shishi_kdcrep_read (Shishi * handle, FILE * fh,
1251 				 Shishi_asn1 * kdcrep);
1252   extern int shishi_kdcrep_from_file (Shishi * handle, Shishi_asn1 * kdcrep,
1253 				      int filetype, const char *filename);
1254   extern int shishi_kdcrep_clear_padata (Shishi * handle, Shishi_asn1 kdcrep);
1255   extern int shishi_kdcrep_get_enc_part_etype (Shishi * handle,
1256 					       Shishi_asn1 kdcrep,
1257 					       int32_t * etype);
1258   extern int shishi_kdcrep_add_enc_part (Shishi * handle,
1259 					 Shishi_asn1 kdcrep,
1260 					 Shishi_key * key,
1261 					 int keyusage,
1262 					 Shishi_asn1 enckdcreppart);
1263   extern int shishi_kdcrep_get_ticket (Shishi * handle,
1264 				       Shishi_asn1 kdcrep,
1265 				       Shishi_asn1 * ticket);
1266   extern int shishi_kdcrep_set_ticket (Shishi * handle, Shishi_asn1 kdcrep,
1267 				       Shishi_asn1 ticket);
1268   extern int shishi_kdcrep_crealm_set (Shishi * handle,
1269 				       Shishi_asn1 kdcrep,
1270 				       const char *crealm);
1271   extern int shishi_kdcrep_cname_set (Shishi * handle, Shishi_asn1 kdcrep,
1272 				      Shishi_name_type name_type,
1273 				      const char *cname[]);
1274   extern int shishi_kdcrep_client_set (Shishi * handle, Shishi_asn1 kdcrep,
1275 				       const char *client);
1276   extern int shishi_kdcrep_crealmserver_set (Shishi * handle,
1277 					     Shishi_asn1 kdcrep,
1278 					     const char *crealm,
1279 					     const char *client);
1280   extern int shishi_kdcrep_set_enc_part (Shishi * handle, Shishi_asn1 kdcrep,
1281 					 int32_t etype, uint32_t kvno,
1282 					 const char *buf, size_t buflen);
1283   extern int shishi_kdcrep_decrypt (Shishi * handle, Shishi_asn1 kdcrep,
1284 				    Shishi_key * key, int keyusage,
1285 				    Shishi_asn1 * enckdcreppart);
1286 
1287 /* enckdcreppart.c */
1288   extern Shishi_asn1 shishi_enckdcreppart (Shishi * handle);
1289   extern Shishi_asn1 shishi_encasreppart (Shishi * handle);
1290   extern int shishi_enckdcreppart_get_key (Shishi * handle,
1291 					   Shishi_asn1 enckdcreppart,
1292 					   Shishi_key ** key);
1293   extern int shishi_enckdcreppart_key_set (Shishi * handle,
1294 					   Shishi_asn1 enckdcreppart,
1295 					   Shishi_key * key);
1296   extern int shishi_enckdcreppart_nonce_set (Shishi * handle,
1297 					     Shishi_asn1 enckdcreppart,
1298 					     uint32_t nonce);
1299   extern int shishi_enckdcreppart_flags_set (Shishi * handle,
1300 					     Shishi_asn1 enckdcreppart,
1301 					     int flags);
1302   extern int shishi_enckdcreppart_authtime_set (Shishi * handle,
1303 						Shishi_asn1 enckdcreppart,
1304 						const char *authtime);
1305   extern int shishi_enckdcreppart_starttime_set (Shishi * handle,
1306 						 Shishi_asn1 enckdcreppart,
1307 						 const char *starttime);
1308   extern int shishi_enckdcreppart_endtime_set (Shishi * handle,
1309 					       Shishi_asn1 enckdcreppart,
1310 					       const char *endtime);
1311   extern int shishi_enckdcreppart_renew_till_set (Shishi * handle,
1312 						  Shishi_asn1 enckdcreppart,
1313 						  const char *renew_till);
1314   extern int shishi_enckdcreppart_srealm_set (Shishi * handle,
1315 					      Shishi_asn1 enckdcreppart,
1316 					      const char *srealm);
1317   extern int shishi_enckdcreppart_sname_set (Shishi * handle,
1318 					     Shishi_asn1 enckdcreppart,
1319 					     Shishi_name_type name_type,
1320 					     char *sname[]);
1321   extern int shishi_enckdcreppart_server_set (Shishi * handle,
1322 					      Shishi_asn1 enckdcreppart,
1323 					      const char *server);
1324   extern int shishi_enckdcreppart_srealmserver_set (Shishi * handle,
1325 						    Shishi_asn1 enckdcreppart,
1326 						    const char *srealm,
1327 						    const char *server);
1328   extern int
1329     shishi_enckdcreppart_populate_encticketpart (Shishi * handle,
1330 						 Shishi_asn1 enckdcreppart,
1331 						 Shishi_asn1 encticketpart);
1332 
1333 /* krberror.c */
1334   extern Shishi_asn1 shishi_krberror (Shishi * handle);
1335   extern int shishi_krberror_print (Shishi * handle, FILE * fh,
1336 				    Shishi_asn1 krberror);
1337   extern int shishi_krberror_save (Shishi * handle, FILE * fh,
1338 				   Shishi_asn1 krberror);
1339   extern int shishi_krberror_to_file (Shishi * handle, Shishi_asn1 krberror,
1340 				      int filetype, const char *filename);
1341   extern int shishi_krberror_parse (Shishi * handle, FILE * fh,
1342 				    Shishi_asn1 * krberror);
1343   extern int shishi_krberror_read (Shishi * handle, FILE * fh,
1344 				   Shishi_asn1 * krberror);
1345   extern int shishi_krberror_from_file (Shishi * handle,
1346 					Shishi_asn1 * krberror, int filetype,
1347 					const char *filename);
1348   extern int shishi_krberror_build (Shishi * handle, Shishi_asn1 krberror);
1349   extern int shishi_krberror_der (Shishi * handle,
1350 				  Shishi_asn1 krberror,
1351 				  char **out, size_t * outlen);
1352   extern int shishi_krberror_crealm (Shishi * handle,
1353 				     Shishi_asn1 krberror,
1354 				     char **realm, size_t * realmlen);
1355   extern int shishi_krberror_remove_crealm (Shishi * handle,
1356 					    Shishi_asn1 krberror);
1357   extern int shishi_krberror_set_crealm (Shishi * handle,
1358 					 Shishi_asn1 krberror,
1359 					 const char *crealm);
1360   extern int shishi_krberror_client (Shishi * handle,
1361 				     Shishi_asn1 krberror,
1362 				     char **client, size_t * clientlen);
1363   extern int shishi_krberror_set_cname (Shishi * handle,
1364 					Shishi_asn1 krberror,
1365 					Shishi_name_type name_type,
1366 					const char *cname[]);
1367   extern int shishi_krberror_remove_cname (Shishi * handle,
1368 					   Shishi_asn1 krberror);
1369   extern int shishi_krberror_client_set (Shishi * handle,
1370 					 Shishi_asn1 krberror,
1371 					 const char *client);
1372   extern int shishi_krberror_realm (Shishi * handle,
1373 				    Shishi_asn1 krberror,
1374 				    char **realm, size_t * realmlen);
1375   extern int shishi_krberror_set_realm (Shishi * handle,
1376 					Shishi_asn1 krberror,
1377 					const char *realm);
1378   extern int shishi_krberror_server (Shishi * handle,
1379 				     Shishi_asn1 krberror,
1380 				     char **server, size_t * serverlen);
1381   extern int shishi_krberror_remove_sname (Shishi * handle,
1382 					   Shishi_asn1 krberror);
1383   extern int shishi_krberror_set_sname (Shishi * handle,
1384 					Shishi_asn1 krberror,
1385 					Shishi_name_type name_type,
1386 					const char *sname[]);
1387   extern int shishi_krberror_server_set (Shishi * handle,
1388 					 Shishi_asn1 krberror,
1389 					 const char *server);
1390   extern int shishi_krberror_ctime (Shishi * handle,
1391 				    Shishi_asn1 krberror, char **t);
1392   extern int shishi_krberror_ctime_set (Shishi * handle,
1393 					Shishi_asn1 krberror, const char *t);
1394   extern int shishi_krberror_remove_ctime (Shishi * handle,
1395 					   Shishi_asn1 krberror);
1396   extern int shishi_krberror_cusec (Shishi * handle, Shishi_asn1 krberror,
1397 				    uint32_t * cusec);
1398   extern int shishi_krberror_cusec_set (Shishi * handle, Shishi_asn1 krberror,
1399 					uint32_t cusec);
1400   extern int shishi_krberror_remove_cusec (Shishi * handle,
1401 					   Shishi_asn1 krberror);
1402   extern int shishi_krberror_stime (Shishi * handle, Shishi_asn1 krberror,
1403 				    char **t);
1404   extern int shishi_krberror_stime_set (Shishi * handle, Shishi_asn1 krberror,
1405 					const char *t);
1406   extern int shishi_krberror_susec (Shishi * handle, Shishi_asn1 krberror,
1407 				    uint32_t * susec);
1408   extern int shishi_krberror_susec_set (Shishi * handle, Shishi_asn1 krberror,
1409 					uint32_t susec);
1410   extern int shishi_krberror_errorcode_set (Shishi * handle,
1411 					    Shishi_asn1 krberror,
1412 					    int errorcode);
1413   extern int shishi_krberror_etext (Shishi * handle, Shishi_asn1 krberror,
1414 				    char **etext, size_t * etextlen);
1415   extern int shishi_krberror_set_etext (Shishi * handle, Shishi_asn1 krberror,
1416 					const char *etext);
1417   extern int shishi_krberror_remove_etext (Shishi * handle,
1418 					   Shishi_asn1 krberror);
1419   extern int shishi_krberror_edata (Shishi * handle, Shishi_asn1 krberror,
1420 				    char **edata, size_t * edatalen);
1421   extern int shishi_krberror_set_edata (Shishi * handle, Shishi_asn1 krberror,
1422 					const char *edata);
1423   extern int shishi_krberror_remove_edata (Shishi * handle,
1424 					   Shishi_asn1 krberror);
1425   extern int shishi_krberror_errorcode (Shishi * handle, Shishi_asn1 krberror,
1426 					int *errorcode);
1427   extern int shishi_krberror_errorcode_fast (Shishi * handle,
1428 					     Shishi_asn1 krberror);
1429   extern int shishi_krberror_pretty_print (Shishi * handle, FILE * fh,
1430 					   Shishi_asn1 krberror);
1431   extern const char *shishi_krberror_errorcode_message (Shishi * handle,
1432 							int errorcode);
1433   extern const char *shishi_krberror_message (Shishi * handle,
1434 					      Shishi_asn1 krberror);
1435   extern int shishi_krberror_methoddata (Shishi * handle,
1436 					 Shishi_asn1 krberror,
1437 					 Shishi_asn1 * methoddata);
1438 
1439 /* gztime.c */
1440   extern const char *shishi_generalize_time (Shishi * handle, time_t t);
1441   extern const char *shishi_generalize_now (Shishi * handle);
1442   extern time_t shishi_generalize_ctime (Shishi * handle, const char *t);
1443   extern int shishi_time (Shishi * handle, Shishi_asn1 node,
1444 			  const char *field, char **t);
1445   extern int shishi_ctime (Shishi * handle, Shishi_asn1 node,
1446 			   const char *field, time_t * t);
1447 
1448 /* nettle.c, libgcrypt.c, ... */
1449   extern int shishi_randomize (Shishi * handle, int strong,
1450 			       void *data, size_t datalen);
1451   extern int shishi_crc (Shishi * handle, const char *in, size_t inlen,
1452 			 char *out[4]);
1453   extern int shishi_md4 (Shishi * handle, const char *in, size_t inlen,
1454 			 char *out[16]);
1455   extern int shishi_md5 (Shishi * handle, const char *in, size_t inlen,
1456 			 char *out[16]);
1457   extern int shishi_hmac_md5 (Shishi * handle, const char *key, size_t keylen,
1458 			      const char *in, size_t inlen,
1459 			      char *outhash[16]);
1460   extern int shishi_hmac_sha1 (Shishi * handle, const char *key,
1461 			       size_t keylen, const char *in, size_t inlen,
1462 			       char *outhash[20]);
1463   extern int shishi_des_cbc_mac (Shishi * handle, const char key[8],
1464 				 const char iv[8], const char *in,
1465 				 size_t inlen, char *out[8]);
1466   extern int shishi_arcfour (Shishi * handle, int decryptp, const char *key,
1467 			     size_t keylen, const char iv[258],
1468 			     char *ivout[258], const char *in, size_t inlen,
1469 			     char **out);
1470   extern int shishi_des (Shishi * handle, int decryptp, const char key[8],
1471 			 const char iv[8], char *ivout[8], const char *in,
1472 			 size_t inlen, char **out);
1473   extern int shishi_3des (Shishi * handle, int decryptp, const char key[24],
1474 			  const char iv[8], char *ivout[8], const char *in,
1475 			  size_t inlen, char **out);
1476   extern int shishi_aes_cts (Shishi * handle, int decryptp, const char *key,
1477 			     size_t keylen, const char iv[16],
1478 			     char *ivout[16], const char *in, size_t inlen,
1479 			     char **out);
1480 
1481 /* crypto.c */
1482   extern int shishi_cipher_supported_p (int type);
1483   extern const char *shishi_cipher_name (int type);
1484   extern int shishi_cipher_blocksize (int type);
1485   extern int shishi_cipher_confoundersize (int type);
1486   extern size_t shishi_cipher_keylen (int type);
1487   extern size_t shishi_cipher_randomlen (int type);
1488   extern int shishi_cipher_defaultcksumtype (int32_t type);
1489   extern int shishi_cipher_parse (const char *cipher);
1490   extern int shishi_checksum_supported_p (int32_t type);
1491   extern const char *shishi_checksum_name (int32_t type);
1492   extern size_t shishi_checksum_cksumlen (int32_t type);
1493   extern int shishi_checksum_parse (const char *checksum);
1494   extern int shishi_string_to_key (Shishi * handle,
1495 				   int32_t keytype,
1496 				   const char *password, size_t passwordlen,
1497 				   const char *salt, size_t saltlen,
1498 				   const char *parameter,
1499 				   Shishi_key * outkey);
1500   extern int shishi_random_to_key (Shishi * handle, int32_t keytype,
1501 				   const char *rnd, size_t rndlen,
1502 				   Shishi_key * outkey);
1503   extern int shishi_encrypt_ivupdate_etype (Shishi * handle, Shishi_key * key,
1504 					    int keyusage, int32_t etype,
1505 					    const char *iv, size_t ivlen,
1506 					    char **ivout, size_t * ivoutlen,
1507 					    const char *in, size_t inlen,
1508 					    char **out, size_t * outlen);
1509   extern int shishi_encrypt_iv_etype (Shishi * handle, Shishi_key * key,
1510 				      int keyusage, int32_t etype,
1511 				      const char *iv, size_t ivlen,
1512 				      const char *in, size_t inlen,
1513 				      char **out, size_t * outlen);
1514   extern int shishi_encrypt_etype (Shishi * handle, Shishi_key * key,
1515 				   int keyusage, int32_t etype,
1516 				   const char *in, size_t inlen, char **out,
1517 				   size_t * outlen);
1518   extern int shishi_encrypt_ivupdate (Shishi * handle, Shishi_key * key,
1519 				      int keyusage, const char *iv,
1520 				      size_t ivlen, char **ivout,
1521 				      size_t * ivoutlen, const char *in,
1522 				      size_t inlen, char **out,
1523 				      size_t * outlen);
1524   extern int shishi_encrypt_iv (Shishi * handle, Shishi_key * key,
1525 				int keyusage, const char *iv, size_t ivlen,
1526 				const char *in, size_t inlen, char **out,
1527 				size_t * outlen);
1528   extern int shishi_encrypt (Shishi * handle, Shishi_key * key, int keyusage,
1529 			     char *in, size_t inlen, char **out,
1530 			     size_t * outlen);
1531   extern int shishi_decrypt_ivupdate_etype (Shishi * handle, Shishi_key * key,
1532 					    int keyusage, int32_t etype,
1533 					    const char *iv, size_t ivlen,
1534 					    char **ivout, size_t * ivoutlen,
1535 					    const char *in, size_t inlen,
1536 					    char **out, size_t * outlen);
1537   extern int shishi_decrypt_iv_etype (Shishi * handle, Shishi_key * key,
1538 				      int keyusage, int32_t etype,
1539 				      const char *iv, size_t ivlen,
1540 				      const char *in, size_t inlen,
1541 				      char **out, size_t * outlen);
1542   extern int shishi_decrypt_etype (Shishi * handle, Shishi_key * key,
1543 				   int keyusage, int32_t etype,
1544 				   const char *in, size_t inlen, char **out,
1545 				   size_t * outlen);
1546   extern int shishi_decrypt_ivupdate (Shishi * handle, Shishi_key * key,
1547 				      int keyusage, const char *iv,
1548 				      size_t ivlen, char **ivout,
1549 				      size_t * ivoutlen, const char *in,
1550 				      size_t inlen, char **out,
1551 				      size_t * outlen);
1552   extern int shishi_decrypt_iv (Shishi * handle, Shishi_key * key,
1553 				int keyusage, const char *iv, size_t ivlen,
1554 				const char *in, size_t inlen, char **out,
1555 				size_t * outlen);
1556   extern int shishi_decrypt (Shishi * handle, Shishi_key * key, int keyusage,
1557 			     const char *in, size_t inlen, char **out,
1558 			     size_t * outlen);
1559   extern int shishi_checksum (Shishi * handle, Shishi_key * key, int keyusage,
1560 			      int32_t cksumtype, const char *in, size_t inlen,
1561 			      char **out, size_t * outlen);
1562   extern int shishi_verify (Shishi * handle, Shishi_key * key, int keyusage,
1563 			    int cksumtype, const char *in, size_t inlen,
1564 			    const char *cksum, size_t cksumlen);
1565   extern int shishi_dk (Shishi * handle, Shishi_key * key,
1566 			const char *prfconstant, size_t prfconstantlen,
1567 			Shishi_key * derivedkey);
1568   extern int shishi_dr (Shishi * handle, Shishi_key * key,
1569 			const char *prfconstant, size_t prfconstantlen,
1570 			char *derivedrandom, size_t derivedrandomlen);
1571   extern int shishi_n_fold (Shishi * handle, const char *in, size_t inlen,
1572 			    char *out, size_t outlen);
1573   extern int shishi_pbkdf2_sha1 (Shishi * handle, const char *P, size_t Plen,
1574 				 const char *S, size_t Slen, unsigned int c,
1575 				 unsigned int dkLen, char *DK);
1576 
1577 /* crypto-ctx.c */
1578   extern Shishi_crypto *shishi_crypto (Shishi * handle,
1579 				       Shishi_key * key, int keyusage,
1580 				       int32_t etype,
1581 				       const char *iv, size_t ivlen);
1582   extern void shishi_crypto_close (Shishi_crypto * ctx);
1583   extern int shishi_crypto_encrypt (Shishi_crypto * ctx,
1584 				    const char *in, size_t inlen,
1585 				    char **out, size_t * outlen);
1586   extern int shishi_crypto_decrypt (Shishi_crypto * ctx,
1587 				    const char *in, size_t inlen,
1588 				    char **out, size_t * outlen);
1589 
1590 /* version.c */
1591   extern const char *shishi_check_version (const char *req_version);
1592 
1593 /* password.c */
1594   typedef int (*shishi_prompt_password_func) (Shishi * handle,
1595 					      char **s,
1596 					      const char *format, va_list ap);
1597   extern void
1598     shishi_prompt_password_callback_set (Shishi * handle,
1599 					 shishi_prompt_password_func cb);
1600   extern shishi_prompt_password_func
1601     shishi_prompt_password_callback_get (Shishi * handle);
1602   extern int
1603     shishi_prompt_password (Shishi * handle, char **s, const char *format,
1604 			    ...);
1605 
1606 /* asn1.c */
1607   extern int shishi_asn1_number_of_elements (Shishi * handle,
1608 					     Shishi_asn1 node,
1609 					     const char *field, size_t * n);
1610   extern int shishi_asn1_empty_p (Shishi * handle, Shishi_asn1 node,
1611 				  const char *field);
1612 
1613   extern int shishi_asn1_read (Shishi * handle, Shishi_asn1 node,
1614 			       const char *field,
1615 			       char **data, size_t * datalen);
1616   extern int shishi_asn1_read_inline (Shishi * handle, Shishi_asn1 node,
1617 				      const char *field,
1618 				      char *data, size_t * datalen);
1619   extern int shishi_asn1_read_integer (Shishi * handle, Shishi_asn1 node,
1620 				       const char *field, int *i);
1621   extern int shishi_asn1_read_int32 (Shishi * handle, Shishi_asn1 node,
1622 				     const char *field, int32_t * i);
1623   extern int shishi_asn1_read_uint32 (Shishi * handle, Shishi_asn1 node,
1624 				      const char *field, uint32_t * i);
1625   extern int shishi_asn1_read_bitstring (Shishi * handle, Shishi_asn1 node,
1626 					 const char *field, uint32_t * flags);
1627   extern int shishi_asn1_read_optional (Shishi * handle,
1628 					Shishi_asn1 node, const char *field,
1629 					char **data, size_t * datalen);
1630 
1631   extern int shishi_asn1_write (Shishi * handle, Shishi_asn1 node,
1632 				const char *field,
1633 				const char *data, size_t datalen);
1634   extern int shishi_asn1_write_integer (Shishi * handle, Shishi_asn1 node,
1635 					const char *field, int n);
1636   extern int shishi_asn1_write_int32 (Shishi * handle, Shishi_asn1 node,
1637 				      const char *field, int32_t n);
1638   extern int shishi_asn1_write_uint32 (Shishi * handle, Shishi_asn1 node,
1639 				       const char *field, uint32_t n);
1640   extern int shishi_asn1_write_bitstring (Shishi * handle, Shishi_asn1 node,
1641 					  const char *field, uint32_t flags);
1642 
1643   extern void shishi_asn1_done (Shishi * handle, Shishi_asn1 node);
1644 
1645   extern Shishi_asn1 shishi_asn1_pa_enc_ts_enc (Shishi * handle);
1646   extern Shishi_asn1 shishi_asn1_encrypteddata (Shishi * handle);
1647   extern Shishi_asn1 shishi_asn1_padata (Shishi * handle);
1648   extern Shishi_asn1 shishi_asn1_methoddata (Shishi * handle);
1649   extern Shishi_asn1 shishi_asn1_etype_info (Shishi * handle);
1650   extern Shishi_asn1 shishi_asn1_etype_info2 (Shishi * handle);
1651   extern Shishi_asn1 shishi_asn1_asreq (Shishi * handle);
1652   extern Shishi_asn1 shishi_asn1_asrep (Shishi * handle);
1653   extern Shishi_asn1 shishi_asn1_tgsreq (Shishi * handle);
1654   extern Shishi_asn1 shishi_asn1_tgsrep (Shishi * handle);
1655   extern Shishi_asn1 shishi_asn1_apreq (Shishi * handle);
1656   extern Shishi_asn1 shishi_asn1_aprep (Shishi * handle);
1657   extern Shishi_asn1 shishi_asn1_ticket (Shishi * handle);
1658   extern Shishi_asn1 shishi_asn1_encapreppart (Shishi * handle);
1659   extern Shishi_asn1 shishi_asn1_encticketpart (Shishi * handle);
1660   extern Shishi_asn1 shishi_asn1_authenticator (Shishi * handle);
1661   extern Shishi_asn1 shishi_asn1_enckdcreppart (Shishi * handle);
1662   extern Shishi_asn1 shishi_asn1_encasreppart (Shishi * handle);
1663   extern Shishi_asn1 shishi_asn1_krberror (Shishi * handle);
1664   extern Shishi_asn1 shishi_asn1_krbsafe (Shishi * handle);
1665   extern Shishi_asn1 shishi_asn1_priv (Shishi * handle);
1666   extern Shishi_asn1 shishi_asn1_encprivpart (Shishi * handle);
1667 
1668   extern int shishi_asn1_to_der (Shishi * handle, Shishi_asn1 node,
1669 				 char **der, size_t * len);
1670   extern int shishi_asn1_to_der_field (Shishi * handle, Shishi_asn1 node,
1671 				       const char *field,
1672 				       char **der, size_t * len);
1673 
1674   extern Shishi_msgtype shishi_asn1_msgtype (Shishi * handle,
1675 					     Shishi_asn1 node);
1676   extern Shishi_msgtype shishi_der_msgtype (Shishi * handle, const char *der,
1677 					    size_t derlen);
1678 
1679   extern void shishi_asn1_print (Shishi * handle, Shishi_asn1 node,
1680 				 FILE * fh);
1681 
1682   extern Shishi_asn1 shishi_der2asn1 (Shishi * handle,
1683 				      const char *der, size_t derlen);
1684   extern Shishi_asn1 shishi_der2asn1_padata (Shishi * handle,
1685 					     const char *der, size_t derlen);
1686   extern Shishi_asn1 shishi_der2asn1_methoddata (Shishi * handle,
1687 						 const char *der,
1688 						 size_t derlen);
1689   extern Shishi_asn1 shishi_der2asn1_etype_info (Shishi * handle,
1690 						 const char *der,
1691 						 size_t derlen);
1692   extern Shishi_asn1 shishi_der2asn1_etype_info2 (Shishi * handle,
1693 						  const char *der,
1694 						  size_t derlen);
1695   extern Shishi_asn1 shishi_der2asn1_ticket (Shishi * handle, const char *der,
1696 					     size_t derlen);
1697   extern Shishi_asn1 shishi_der2asn1_encticketpart (Shishi * handle,
1698 						    const char *der,
1699 						    size_t derlen);
1700   extern Shishi_asn1 shishi_der2asn1_asreq (Shishi * handle, const char *der,
1701 					    size_t derlen);
1702   extern Shishi_asn1 shishi_der2asn1_tgsreq (Shishi * handle, const char *der,
1703 					     size_t derlen);
1704   extern Shishi_asn1 shishi_der2asn1_asrep (Shishi * handle, const char *der,
1705 					    size_t derlen);
1706   extern Shishi_asn1 shishi_der2asn1_tgsrep (Shishi * handle, const char *der,
1707 					     size_t derlen);
1708   extern Shishi_asn1 shishi_der2asn1_kdcrep (Shishi * handle, const char *der,
1709 					     size_t derlen);
1710   extern Shishi_asn1 shishi_der2asn1_kdcreq (Shishi * handle, const char *der,
1711 					     size_t derlen);
1712   extern Shishi_asn1 shishi_der2asn1_apreq (Shishi * handle, const char *der,
1713 					    size_t derlen);
1714   extern Shishi_asn1 shishi_der2asn1_aprep (Shishi * handle, const char *der,
1715 					    size_t derlen);
1716   extern Shishi_asn1 shishi_der2asn1_authenticator (Shishi * handle,
1717 						    const char *der,
1718 						    size_t derlen);
1719   extern Shishi_asn1 shishi_der2asn1_krberror (Shishi * handle,
1720 					       const char *der,
1721 					       size_t derlen);
1722   extern Shishi_asn1 shishi_der2asn1_krbsafe (Shishi * handle,
1723 					      const char *der, size_t derlen);
1724   extern Shishi_asn1 shishi_der2asn1_priv (Shishi * handle, const char *der,
1725 					   size_t derlen);
1726   extern Shishi_asn1 shishi_der2asn1_encasreppart (Shishi * handle,
1727 						   const char *der,
1728 						   size_t derlen);
1729   extern Shishi_asn1 shishi_der2asn1_enctgsreppart (Shishi * handle,
1730 						    const char *der,
1731 						    size_t derlen);
1732   extern Shishi_asn1 shishi_der2asn1_enckdcreppart (Shishi * handle,
1733 						    const char *der,
1734 						    size_t derlen);
1735   extern Shishi_asn1 shishi_der2asn1_encapreppart (Shishi * handle,
1736 						   const char *der,
1737 						   size_t derlen);
1738   extern Shishi_asn1 shishi_der2asn1_encprivpart (Shishi * handle,
1739 						  const char *der,
1740 						  size_t derlen);
1741 
1742 /* ap.c */
1743   extern int shishi_ap (Shishi * handle, Shishi_ap ** ap);
1744   extern int shishi_ap_etype (Shishi * handle, Shishi_ap ** ap, int etype);
1745   extern int shishi_ap_nosubkey (Shishi * handle, Shishi_ap ** ap);
1746   extern void shishi_ap_done (Shishi_ap * ap);
1747   extern int shishi_ap_set_tktoptions (Shishi_ap * ap,
1748 				       Shishi_tkt * tkt, int options);
1749   extern int shishi_ap_tktoptions (Shishi * handle,
1750 				   Shishi_ap ** ap,
1751 				   Shishi_tkt * tkt, int options);
1752   extern int shishi_ap_etype_tktoptionsdata (Shishi * handle,
1753 					     Shishi_ap ** ap,
1754 					     int32_t etype,
1755 					     Shishi_tkt * tkt, int options,
1756 					     const char *data, size_t len);
1757   extern int shishi_ap_set_tktoptionsdata (Shishi_ap * ap,
1758 					   Shishi_tkt * tkt,
1759 					   int options,
1760 					   const char *data, size_t len);
1761   extern int shishi_ap_tktoptionsdata (Shishi * handle,
1762 				       Shishi_ap ** ap,
1763 				       Shishi_tkt * tkt,
1764 				       int options,
1765 				       const char *data, size_t len);
1766   extern int shishi_ap_set_tktoptionsraw (Shishi_ap * ap,
1767 					  Shishi_tkt * tkt,
1768 					  int options,
1769 					  int32_t cksumtype,
1770 					  const char *data, size_t len);
1771   extern int shishi_ap_tktoptionsraw (Shishi * handle,
1772 				      Shishi_ap ** ap,
1773 				      Shishi_tkt * tkt, int options,
1774 				      int32_t cksumtype,
1775 				      const char *data, size_t len);
1776   extern int shishi_ap_set_tktoptionsasn1usage (Shishi_ap * ap,
1777 						Shishi_tkt * tkt,
1778 						int options,
1779 						Shishi_asn1 node,
1780 						const char *field,
1781 						int
1782 						authenticatorcksumkeyusage,
1783 						int authenticatorkeyusage);
1784   extern int shishi_ap_tktoptionsasn1usage (Shishi * handle, Shishi_ap ** ap,
1785 					    Shishi_tkt * tkt, int options,
1786 					    Shishi_asn1 node,
1787 					    const char *field,
1788 					    int authenticatorcksumkeyusage,
1789 					    int authenticatorkeyusage);
1790 
1791   extern Shishi_tkt *shishi_ap_tkt (Shishi_ap * ap);
1792   extern void shishi_ap_tkt_set (Shishi_ap * ap, Shishi_tkt * tkt);
1793 
1794   extern int shishi_ap_authenticator_cksumdata (Shishi_ap * ap,
1795 						char *out, size_t * len);
1796   extern void
1797     shishi_ap_authenticator_cksumdata_set (Shishi_ap * ap,
1798 					   const char *authenticatorcksumdata,
1799 					   size_t authenticatorcksumdatalen);
1800   extern void
1801     shishi_ap_authenticator_cksumraw_set (Shishi_ap * ap,
1802 					  int32_t authenticatorcksumtype,
1803 					  const char *authenticatorcksumraw,
1804 					  size_t authenticatorcksumrawlen);
1805   extern int32_t shishi_ap_authenticator_cksumtype (Shishi_ap * ap);
1806   extern void shishi_ap_authenticator_cksumtype_set (Shishi_ap * ap,
1807 						     int32_t cksumtype);
1808 
1809   extern Shishi_asn1 shishi_ap_authenticator (Shishi_ap * ap);
1810   extern void shishi_ap_authenticator_set (Shishi_ap * ap,
1811 					   Shishi_asn1 authenticator);
1812 
1813   extern Shishi_asn1 shishi_ap_req (Shishi_ap * ap);
1814   extern void shishi_ap_req_set (Shishi_ap * ap, Shishi_asn1 apreq);
1815   extern int shishi_ap_req_der (Shishi_ap * ap, char **out, size_t * outlen);
1816   extern int shishi_ap_req_der_set (Shishi_ap * ap, char *der, size_t derlen);
1817   extern int shishi_ap_req_build (Shishi_ap * ap);
1818   extern int shishi_ap_req_asn1 (Shishi_ap * ap, Shishi_asn1 * apreq);
1819   extern Shishi_key *shishi_ap_key (Shishi_ap * ap);
1820   extern int shishi_ap_req_decode (Shishi_ap * ap);
1821   extern int shishi_ap_req_process (Shishi_ap * ap, Shishi_key * key);
1822   extern int shishi_ap_req_process_keyusage (Shishi_ap * ap,
1823 					     Shishi_key * key,
1824 					     int32_t keyusage);
1825 
1826   extern Shishi_asn1 shishi_ap_rep (Shishi_ap * ap);
1827   extern void shishi_ap_rep_set (Shishi_ap * ap, Shishi_asn1 aprep);
1828   extern int shishi_ap_rep_der (Shishi_ap * ap, char **out, size_t * outlen);
1829   extern int shishi_ap_rep_der_set (Shishi_ap * ap, char *der, size_t derlen);
1830   extern int shishi_ap_rep_verify (Shishi_ap * ap);
1831   extern int shishi_ap_rep_verify_der (Shishi_ap * ap, char *der,
1832 				       size_t derlen);
1833   extern int shishi_ap_rep_verify_asn1 (Shishi_ap * ap, Shishi_asn1 aprep);
1834   extern int shishi_ap_rep_asn1 (Shishi_ap * ap, Shishi_asn1 * aprep);
1835   extern int shishi_ap_rep_build (Shishi_ap * ap);
1836 
1837   extern Shishi_asn1 shishi_ap_encapreppart (Shishi_ap * ap);
1838   extern void shishi_ap_encapreppart_set (Shishi_ap * ap,
1839 					  Shishi_asn1 encapreppart);
1840 
1841   extern const char *shishi_ap_option2string (Shishi_apoptions option);
1842   extern Shishi_apoptions shishi_ap_string2option (const char *str);
1843 
1844 /* key.c */
1845   extern const char *shishi_key_principal (const Shishi_key * key);
1846   extern void shishi_key_principal_set (Shishi_key * key,
1847 					const char *principal);
1848   extern const char *shishi_key_realm (const Shishi_key * key);
1849   extern void shishi_key_realm_set (Shishi_key * key, const char *realm);
1850   extern int shishi_key_type (const Shishi_key * key);
1851   extern void shishi_key_type_set (Shishi_key * key, int32_t type);
1852   extern const char *shishi_key_value (const Shishi_key * key);
1853   extern void shishi_key_value_set (Shishi_key * key, const char *value);
1854   extern const char *shishi_key_name (Shishi_key * key);
1855   extern size_t shishi_key_length (const Shishi_key * key);
1856   extern uint32_t shishi_key_version (const Shishi_key * key);
1857   extern void shishi_key_version_set (Shishi_key * key, uint32_t kvno);
1858   extern time_t shishi_key_timestamp (const Shishi_key * key);
1859   extern void shishi_key_timestamp_set (Shishi_key * key, time_t timestamp);
1860   extern int shishi_key (Shishi * handle, Shishi_key ** key);
1861   extern void shishi_key_done (Shishi_key * key);
1862   extern void shishi_key_copy (Shishi_key * dstkey, Shishi_key * srckey);
1863   extern int shishi_key_print (Shishi * handle, FILE * fh,
1864 			       const Shishi_key * key);
1865   extern int shishi_key_to_file (Shishi * handle,
1866 				 const char *filename, Shishi_key * key);
1867   extern int shishi_key_parse (Shishi * handle, FILE * fh, Shishi_key ** key);
1868   extern int shishi_key_random (Shishi * handle,
1869 				int32_t type, Shishi_key ** key);
1870   extern int shishi_key_from_value (Shishi * handle,
1871 				    int32_t type,
1872 				    const char *value, Shishi_key ** key);
1873   extern int shishi_key_from_base64 (Shishi * handle,
1874 				     int32_t type,
1875 				     const char *value, Shishi_key ** key);
1876   extern int shishi_key_from_random (Shishi * handle,
1877 				     int32_t type,
1878 				     const char *rnd,
1879 				     size_t rndlen, Shishi_key ** outkey);
1880   extern int shishi_key_from_string (Shishi * handle,
1881 				     int32_t type,
1882 				     const char *password, size_t passwordlen,
1883 				     const char *salt, size_t saltlen,
1884 				     const char *parameter,
1885 				     Shishi_key ** outkey);
1886   extern int shishi_key_from_name (Shishi * handle,
1887 				   int32_t type,
1888 				   const char *name,
1889 				   const char *password, size_t passwordlen,
1890 				   const char *parameter,
1891 				   Shishi_key ** outkey);
1892 
1893 /* keys.c */
1894   extern int shishi_keys (Shishi * handle, Shishi_keys ** keys);
1895   extern void shishi_keys_done (Shishi_keys ** keys);
1896   extern int shishi_keys_size (Shishi_keys * keys);
1897   extern const Shishi_key *shishi_keys_nth (Shishi_keys * keys, int keyno);
1898   extern void shishi_keys_remove (Shishi_keys * keys, int keyno);
1899   extern int shishi_keys_add (Shishi_keys * keys, Shishi_key * key);
1900 
1901   extern int shishi_keys_print (Shishi_keys * keys, FILE * fh);
1902   extern int shishi_keys_from_file (Shishi_keys * keys, const char *filename);
1903   extern int shishi_keys_to_file (Shishi * handle,
1904 				  const char *filename, Shishi_keys * keys);
1905 
1906   extern Shishi_key *shishi_keys_for_serverrealm_in_file (Shishi * handle,
1907 							  const char
1908 							  *filename,
1909 							  const char *server,
1910 							  const char *realm);
1911   extern Shishi_key *shishi_keys_for_server_in_file (Shishi * handle,
1912 						     const char *filename,
1913 						     const char *server);
1914   extern Shishi_key *shishi_keys_for_localservicerealm_in_file (Shishi *
1915 								handle,
1916 								const char
1917 								*filename,
1918 								const char
1919 								*service,
1920 								const char
1921 								*realm);
1922 
1923 /* keytab.c */
1924   extern int shishi_keys_add_keytab_mem (Shishi * handle,
1925 					 const char *data, size_t len,
1926 					 Shishi_keys * keys);
1927   extern int shishi_keys_add_keytab_file (Shishi * handle,
1928 					  const char *filename,
1929 					  Shishi_keys * keys);
1930   extern int shishi_keys_from_keytab_mem (Shishi * handle,
1931 					  const char *data, size_t len,
1932 					  Shishi_keys ** outkeys);
1933   extern int shishi_keys_from_keytab_file (Shishi * handle,
1934 					   const char *filename,
1935 					   Shishi_keys ** outkeys);
1936   extern int shishi_keys_to_keytab_mem (Shishi * handle,
1937 					Shishi_keys * keys,
1938 					char **out, size_t * len);
1939   extern int shishi_keys_to_keytab_file (Shishi * handle,
1940 					 Shishi_keys * keys,
1941 					 const char *filename);
1942 
1943 /* hostkeys.c */
1944   extern const char *shishi_hostkeys_default_file (Shishi * handle);
1945   extern void shishi_hostkeys_default_file_set (Shishi * handle,
1946 						const char *hostkeysfile);
1947   extern Shishi_key *shishi_hostkeys_for_server (Shishi * handle,
1948 						 const char *server);
1949   extern Shishi_key *shishi_hostkeys_for_serverrealm (Shishi * handle,
1950 						      const char *server,
1951 						      const char *realm);
1952   extern Shishi_key *shishi_hostkeys_for_localservicerealm (Shishi * handle,
1953 							    const char
1954 							    *service,
1955 							    const char
1956 							    *realm);
1957   extern Shishi_key *shishi_hostkeys_for_localservice (Shishi * handle,
1958 						       const char *service);
1959 
1960 /* encapreppart.c */
1961   extern Shishi_asn1 shishi_encapreppart (Shishi * handle);
1962   extern int shishi_encapreppart_time_copy (Shishi * handle,
1963 					    Shishi_asn1 encapreppart,
1964 					    Shishi_asn1 authenticator);
1965   extern int shishi_encapreppart_ctime (Shishi * handle,
1966 					Shishi_asn1 encapreppart, char **t);
1967   extern int shishi_encapreppart_ctime_set (Shishi * handle,
1968 					    Shishi_asn1 encapreppart,
1969 					    const char *t);
1970   extern int shishi_encapreppart_cusec_get (Shishi * handle,
1971 					    Shishi_asn1 encapreppart,
1972 					    uint32_t * cusec);
1973   extern int shishi_encapreppart_cusec_set (Shishi * handle,
1974 					    Shishi_asn1 encapreppart,
1975 					    uint32_t cusec);
1976   extern int shishi_encapreppart_print (Shishi * handle, FILE * fh,
1977 					Shishi_asn1 encapreppart);
1978   extern int shishi_encapreppart_save (Shishi * handle, FILE * fh,
1979 				       Shishi_asn1 encapreppart);
1980   extern int shishi_encapreppart_to_file (Shishi * handle,
1981 					  Shishi_asn1 encapreppart,
1982 					  int filetype, const char *filename);
1983   extern int shishi_encapreppart_read (Shishi * handle, FILE * fh,
1984 				       Shishi_asn1 * encapreppart);
1985   extern int shishi_encapreppart_parse (Shishi * handle, FILE * fh,
1986 					Shishi_asn1 * encapreppart);
1987   extern int shishi_encapreppart_from_file (Shishi * handle,
1988 					    Shishi_asn1 * encapreppart,
1989 					    int filetype,
1990 					    const char *filename);
1991   extern int shishi_encapreppart_get_key (Shishi * handle,
1992 					  Shishi_asn1 encapreppart,
1993 					  Shishi_key ** key);
1994   extern int shishi_encapreppart_seqnumber_get (Shishi * handle,
1995 						Shishi_asn1 encapreppart,
1996 						uint32_t * seqnumber);
1997   extern int shishi_encapreppart_seqnumber_remove (Shishi * handle,
1998 						   Shishi_asn1 encapreppart);
1999   extern int shishi_encapreppart_seqnumber_set (Shishi * handle,
2000 						Shishi_asn1 encapreppart,
2001 						uint32_t seqnumber);
2002 
2003 /* apreq.c */
2004   extern Shishi_asn1 shishi_apreq (Shishi * handle);
2005   extern int shishi_apreq_parse (Shishi * handle, FILE * fh,
2006 				 Shishi_asn1 * apreq);
2007   extern int shishi_apreq_from_file (Shishi * handle, Shishi_asn1 * apreq,
2008 				     int filetype, const char *filename);
2009   extern int shishi_apreq_print (Shishi * handle, FILE * fh,
2010 				 Shishi_asn1 apreq);
2011   extern int shishi_apreq_to_file (Shishi * handle, Shishi_asn1 apreq,
2012 				   int filetype, const char *filename);
2013   extern int shishi_apreq_read (Shishi * handle, FILE * fh,
2014 				Shishi_asn1 * apreq);
2015   extern int shishi_apreq_save (Shishi * handle, FILE * fh,
2016 				Shishi_asn1 apreq);
2017   extern int shishi_apreq_set_ticket (Shishi * handle, Shishi_asn1 apreq,
2018 				      Shishi_asn1 ticket);
2019   extern int shishi_apreq_set_authenticator (Shishi * handle,
2020 					     Shishi_asn1 apreq, int32_t etype,
2021 					     uint32_t kvno, const char *buf,
2022 					     size_t buflen);
2023   extern int shishi_apreq_add_authenticator (Shishi * handle,
2024 					     Shishi_asn1 apreq,
2025 					     Shishi_key * key, int keyusage,
2026 					     Shishi_asn1 authenticator);
2027   extern int shishi_apreq_options (Shishi * handle, Shishi_asn1 apreq,
2028 				   uint32_t * flags);
2029   extern int shishi_apreq_use_session_key_p (Shishi * handle,
2030 					     Shishi_asn1 apreq);
2031   extern int shishi_apreq_mutual_required_p (Shishi * handle,
2032 					     Shishi_asn1 apreq);
2033   extern int shishi_apreq_options_set (Shishi * handle, Shishi_asn1 apreq,
2034 				       uint32_t options);
2035   extern int shishi_apreq_options_add (Shishi * handle, Shishi_asn1 apreq,
2036 				       uint32_t option);
2037   extern int shishi_apreq_options_remove (Shishi * handle, Shishi_asn1 apreq,
2038 					  uint32_t option);
2039   extern int shishi_apreq_get_ticket (Shishi * handle, Shishi_asn1 apreq,
2040 				      Shishi_asn1 * ticket);
2041   extern int shishi_apreq_get_authenticator_etype (Shishi * handle,
2042 						   Shishi_asn1 apreq,
2043 						   int32_t * etype);
2044   extern int shishi_apreq_decrypt (Shishi * handle, Shishi_asn1 apreq,
2045 				   Shishi_key * key, int keyusage,
2046 				   Shishi_asn1 * authenticator);
2047 
2048 /* aprep.c */
2049   extern Shishi_asn1 shishi_aprep (Shishi * handle);
2050   extern int shishi_aprep_print (Shishi * handle, FILE * fh,
2051 				 Shishi_asn1 aprep);
2052   extern int shishi_aprep_save (Shishi * handle, FILE * fh,
2053 				Shishi_asn1 aprep);
2054   extern int shishi_aprep_to_file (Shishi * handle, Shishi_asn1 aprep,
2055 				   int filetype, const char *filename);
2056   extern int shishi_aprep_read (Shishi * handle, FILE * fh,
2057 				Shishi_asn1 * aprep);
2058   extern int shishi_aprep_parse (Shishi * handle, FILE * fh,
2059 				 Shishi_asn1 * aprep);
2060   extern int shishi_aprep_from_file (Shishi * handle, Shishi_asn1 * aprep,
2061 				     int filetype, const char *filename);
2062   extern int shishi_aprep_decrypt (Shishi * handle, Shishi_asn1 aprep,
2063 				   Shishi_key * key, int keyusage,
2064 				   Shishi_asn1 * encapreppart);
2065   extern int shishi_aprep_verify (Shishi * handle, Shishi_asn1 authenticator,
2066 				  Shishi_asn1 encapreppart);
2067   extern int shishi_aprep_enc_part_set (Shishi * handle, Shishi_asn1 aprep,
2068 					int etype, const char *buf,
2069 					size_t buflen);
2070   extern int shishi_aprep_enc_part_add (Shishi * handle, Shishi_asn1 aprep,
2071 					Shishi_asn1 encticketpart,
2072 					Shishi_asn1 encapreppart);
2073   extern int shishi_aprep_enc_part_make (Shishi * handle, Shishi_asn1 aprep,
2074 					 Shishi_asn1 encapreppart,
2075 					 Shishi_asn1 authenticator,
2076 					 Shishi_asn1 encticketpart);
2077   extern int shishi_aprep_get_enc_part_etype (Shishi * handle,
2078 					      Shishi_asn1 aprep,
2079 					      int32_t * etype);
2080 
2081 /* netio.c */
2082   extern int shishi_kdc_sendrecv (Shishi * handle, const char *realm,
2083 				  const char *indata, size_t inlen,
2084 				  char **outdata, size_t * outlen);
2085   extern int shishi_kdc_sendrecv_hint (Shishi * handle, const char *realm,
2086 				       const char *indata, size_t inlen,
2087 				       char **outdata, size_t * outlen,
2088 				       Shishi_tkts_hint * hint);
2089 
2090 /* encticketpart.c */
2091   extern Shishi_asn1 shishi_encticketpart (Shishi * handle);
2092   extern int shishi_encticketpart_key_set (Shishi * handle,
2093 					   Shishi_asn1 encticketpart,
2094 					   Shishi_key * key);
2095   extern int shishi_encticketpart_get_key (Shishi * handle,
2096 					   Shishi_asn1 encticketpart,
2097 					   Shishi_key ** key);
2098   extern int shishi_encticketpart_crealm (Shishi * handle,
2099 					  Shishi_asn1 encticketpart,
2100 					  char **crealm, size_t * crealmlen);
2101   extern int shishi_encticketpart_crealm_set (Shishi * handle,
2102 					      Shishi_asn1 encticketpart,
2103 					      const char *realm);
2104   extern int shishi_encticketpart_client (Shishi * handle,
2105 					  Shishi_asn1 encticketpart,
2106 					  char **client, size_t * clientlen);
2107   extern int shishi_encticketpart_clientrealm (Shishi * handle,
2108 					       Shishi_asn1 encticketpart,
2109 					       char **client,
2110 					       size_t * clientlen);
2111   extern int shishi_encticketpart_cname_set (Shishi * handle,
2112 					     Shishi_asn1 encticketpart,
2113 					     Shishi_name_type name_type,
2114 					     const char *principal);
2115   extern int shishi_encticketpart_print (Shishi * handle, FILE * fh,
2116 					 Shishi_asn1 encticketpart);
2117   extern int shishi_encticketpart_flags_set (Shishi * handle,
2118 					     Shishi_asn1 encticketpart,
2119 					     int flags);
2120   extern int shishi_encticketpart_transited_set (Shishi * handle,
2121 						 Shishi_asn1 encticketpart,
2122 						 int32_t trtype,
2123 						 const char *trdata,
2124 						 size_t trdatalen);
2125   extern int shishi_encticketpart_authtime_set (Shishi * handle,
2126 						Shishi_asn1 encticketpart,
2127 						const char *authtime);
2128   extern int shishi_encticketpart_endtime_set (Shishi * handle,
2129 					       Shishi_asn1 encticketpart,
2130 					       const char *endtime);
2131   extern int shishi_encticketpart_authtime (Shishi * handle,
2132 					    Shishi_asn1 encticketpart,
2133 					    char *authtime,
2134 					    size_t * authtimelen);
2135   extern time_t shishi_encticketpart_authctime (Shishi * handle,
2136 						Shishi_asn1 encticketpart);
2137 
2138 /* safe.c */
2139   extern int shishi_safe (Shishi * handle, Shishi_safe ** safe);
2140   extern void shishi_safe_done (Shishi_safe * safe);
2141   extern Shishi_key *shishi_safe_key (Shishi_safe * safe);
2142   extern void shishi_safe_key_set (Shishi_safe * safe, Shishi_key * key);
2143   extern Shishi_asn1 shishi_safe_safe (Shishi_safe * safe);
2144   extern void shishi_safe_safe_set (Shishi_safe * safe, Shishi_asn1 asn1safe);
2145   extern int shishi_safe_safe_der (Shishi_safe * safe, char **out,
2146 				   size_t * outlen);
2147   extern int shishi_safe_safe_der_set (Shishi_safe * safe,
2148 				       char *der, size_t derlen);
2149   extern int shishi_safe_print (Shishi * handle, FILE * fh, Shishi_asn1 safe);
2150   extern int shishi_safe_save (Shishi * handle, FILE * fh, Shishi_asn1 safe);
2151   extern int shishi_safe_to_file (Shishi * handle, Shishi_asn1 safe,
2152 				  int filetype, const char *filename);
2153   extern int shishi_safe_parse (Shishi * handle, FILE * fh,
2154 				Shishi_asn1 * safe);
2155   extern int shishi_safe_read (Shishi * handle, FILE * fh,
2156 			       Shishi_asn1 * safe);
2157   extern int shishi_safe_from_file (Shishi * handle, Shishi_asn1 * safe,
2158 				    int filetype, const char *filename);
2159   extern int shishi_safe_cksum (Shishi * handle, Shishi_asn1 safe,
2160 				int32_t * cksumtype, char **cksum,
2161 				size_t * cksumlen);
2162   extern int shishi_safe_set_cksum (Shishi * handle, Shishi_asn1 safe,
2163 				    int32_t cksumtype, const char *cksum,
2164 				    size_t cksumlen);
2165   extern int shishi_safe_user_data (Shishi * handle, Shishi_asn1 safe,
2166 				    char **userdata, size_t * userdatalen);
2167   extern int shishi_safe_set_user_data (Shishi * handle, Shishi_asn1 safe,
2168 					const char *userdata,
2169 					size_t userdatalen);
2170   extern int shishi_safe_build (Shishi_safe * safe, Shishi_key * key);
2171   extern int shishi_safe_verify (Shishi_safe * safe, Shishi_key * key);
2172 
2173 /* priv.c */
2174   extern int shishi_priv (Shishi * handle, Shishi_priv ** priv);
2175   extern void shishi_priv_done (Shishi_priv * priv);
2176   extern Shishi_key *shishi_priv_key (Shishi_priv * priv);
2177   extern void shishi_priv_key_set (Shishi_priv * priv, Shishi_key * key);
2178   extern Shishi_asn1 shishi_priv_priv (Shishi_priv * priv);
2179   extern void shishi_priv_priv_set (Shishi_priv * priv, Shishi_asn1 asn1priv);
2180   extern int shishi_priv_priv_der (Shishi_priv * priv, char **out,
2181 				   size_t * outlen);
2182   extern int shishi_priv_priv_der_set (Shishi_priv * priv,
2183 				       char *der, size_t derlen);
2184   extern Shishi_asn1 shishi_priv_encprivpart (Shishi_priv * priv);
2185   extern void shishi_priv_encprivpart_set (Shishi_priv * priv,
2186 					   Shishi_asn1 asn1encprivpart);
2187   extern int shishi_priv_encprivpart_der (Shishi_priv * priv, char **out,
2188 					  size_t * outlen);
2189   extern int shishi_priv_encprivpart_der_set (Shishi_priv * priv,
2190 					      char *der, size_t derlen);
2191   extern int shishi_priv_print (Shishi * handle, FILE * fh, Shishi_asn1 priv);
2192   extern int shishi_priv_save (Shishi * handle, FILE * fh, Shishi_asn1 priv);
2193   extern int shishi_priv_to_file (Shishi * handle, Shishi_asn1 priv,
2194 				  int filetype, const char *filename);
2195   extern int shishi_priv_parse (Shishi * handle, FILE * fh,
2196 				Shishi_asn1 * priv);
2197   extern int shishi_priv_read (Shishi * handle, FILE * fh,
2198 			       Shishi_asn1 * priv);
2199   extern int shishi_priv_from_file (Shishi * handle, Shishi_asn1 * priv,
2200 				    int filetype, const char *filename);
2201   extern int shishi_priv_enc_part_etype (Shishi * handle, Shishi_asn1 priv,
2202 					 int32_t * etype);
2203   extern int shishi_priv_set_enc_part (Shishi * handle, Shishi_asn1 priv,
2204 				       int32_t etype, const char *encpart,
2205 				       size_t encpartlen);
2206   extern int shishi_encprivpart_user_data (Shishi * handle,
2207 					   Shishi_asn1 encprivpart,
2208 					   char **userdata,
2209 					   size_t * userdatalen);
2210   extern int shishi_encprivpart_set_user_data (Shishi * handle,
2211 					       Shishi_asn1 encprivpart,
2212 					       const char *userdata,
2213 					       size_t userdatalen);
2214   extern int shishi_priv_build (Shishi_priv * priv, Shishi_key * key);
2215   extern int shishi_priv_process (Shishi_priv * priv, Shishi_key * key);
2216 
2217 /* authorize.c */
2218   extern int shishi_authorized_p (Shishi * handle,
2219 				  Shishi_tkt * tkt, const char *authzname);
2220   extern int shishi_authorization_parse (const char *authorization);
2221   extern int shishi_authorize_strcmp (Shishi * handle, const char *principal,
2222 				      const char *authzname);
2223   extern int shishi_authorize_k5login (Shishi * handle, const char *principal,
2224 				       const char *authzname);
2225 
2226 /* pki.c */
2227   extern char *shishi_x509ca_default_file_guess (Shishi * handle);
2228   extern void shishi_x509ca_default_file_set (Shishi * handle,
2229 					      const char *x509cafile);
2230   extern const char *shishi_x509ca_default_file (Shishi * handle);
2231   extern char *shishi_x509cert_default_file_guess (Shishi * handle);
2232   extern void shishi_x509cert_default_file_set (Shishi * handle,
2233 						const char *x509certfile);
2234   extern const char *shishi_x509cert_default_file (Shishi * handle);
2235   extern char *shishi_x509key_default_file_guess (Shishi * handle);
2236   extern void shishi_x509key_default_file_set (Shishi * handle,
2237 					       const char *x509keyfile);
2238   extern const char *shishi_x509key_default_file (Shishi * handle);
2239 
2240 /* utils.c */
2241   extern time_t shishi_get_date (const char *p, const time_t * now);
2242 /* Ugly hack to avoid re-declaring shishi_xalloc_die twice.  It is
2243    already declared in xalloc.h internally in Shishi.h.  This is to
2244    keep being able to use -Wredundant-decls. */
2245 #if defined SYSTEMCFGFILE && !defined XALLOC_H_
2246   extern void shishi_xalloc_die (void) __attribute__ ((__noreturn__));
2247 #endif
2248 
2249 /* resolv.c */
2250   extern Shishi_dns shishi_resolv (const char *zone, uint16_t querytype);
2251   extern void shishi_resolv_free (Shishi_dns rrs);
2252 
2253 # ifdef __cplusplus
2254 }
2255 # endif
2256 
2257 #endif
2258