Add.
[krb5dissect.git] / keytab.h
blobb951ce61107913dac6bcb240afa747cc02020db8
1 /* keytab.h --- Read MIT style Kerberos Credential Cache file.
2 * Copyright (C) 2006, 2007 Simon Josefsson
4 * This file is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published
6 * by the Free Software Foundation; either version 2 of the License,
7 * or (at your option) any later version.
9 * This file is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this file; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
17 * 02110-1301, USA
21 #ifndef KEYTAB_H
22 #define KEYTAB_H 1
24 #include <stdint.h>
25 #include <string.h>
27 #define KEYTAB_MAX_COMPONENTS 5
28 #define KEYTAB_MAX_KEYLEN 32
30 struct keytab_buffer
32 uint16_t length;
33 char *data;
36 struct keytab_principal
38 uint32_t name_type;
39 uint16_t num_components;
40 struct keytab_buffer realm;
41 struct keytab_buffer components[KEYTAB_MAX_COMPONENTS];
44 struct keytab_keyblock
46 uint8_t vno8;
47 uint16_t type;
48 uint16_t keylen;
49 char *keyvalue;
50 uint32_t vno;
52 char storage[KEYTAB_MAX_KEYLEN]; /* usable by caller for storing
53 keys that keyvalue point to. */
56 struct keytab_entry
58 int32_t size;
59 uint16_t num_components;
60 struct keytab_principal name;
61 uint32_t timestamp;
62 struct keytab_keyblock key;
65 struct keytab
67 uint16_t file_format_version;
68 uint16_t headerlen;
69 char *header;
70 struct keytab_principal default_principal;
71 size_t credentialslen;
72 char *credentials;
73 uint32_t keytabslen;
74 char *keytabs;
77 extern int keytab_parse (const char *data, size_t length, struct keytab *out);
79 extern int keytab_parse_entry (const char *data, size_t len,
80 struct keytab_entry *out,
81 size_t * n);
83 #ifdef ENABLE_PRINT
84 extern void keytab_print (struct keytab *keytab);
85 extern void keytab_print_principal (struct keytab_principal *princ);
86 extern void keytab_print_entry (struct keytab_entry *cred);
87 #endif
89 #endif /* KEYTAB_H */