Wireshark 4.7.0
The Wireshark network protocol analyzer
Loading...
Searching...
No Matches
read_keytab_file.h
1/* read_keytab_file.h
2 * Routines for reading Kerberos keytab files
3 * Copyright 2007, Anders Broman <[email protected]>
4 *
5 * Wireshark - Network traffic analyzer
6 * By Gerald Combs <[email protected]>
7 * Copyright 1998 Gerald Combs
8 *
9 * SPDX-License-Identifier: GPL-2.0-or-later
10 */
11#pragma once
12#include "ws_symbol_export.h"
13
14#ifdef __cplusplus
15extern "C" {
16#endif /* __cplusplus */
17
23WS_DLL_PUBLIC
24void keytab_file_read(const char *filename);
25
26#ifdef HAVE_KERBEROS
27#define KRB_MAX_KEY_LENGTH 32
28
29#if defined(HAVE_HEIMDAL_KERBEROS) || defined(HAVE_MIT_KERBEROS)
30
31typedef struct _enc_key_t {
32 struct _enc_key_t* next;
33 int keytype;
34 int keylength;
35 uint8_t keyvalue[KRB_MAX_KEY_LENGTH];
36 char* key_origin;
37 int fd_num; /* remember where we learned a key */
38 unsigned id; /* a unique id of the key, relative to fd_num */
39 char* id_str;
40 /* EncTicketPart_key */
41 bool is_ticket_key;
42 /* EncAPRepPart_subkey */
43 bool is_ap_rep_key;
44 /*
45 * for now taken from dissect_krb5_PAC_UPN_DNS_INFO,
46 * we could also use dissect_krb5_PAC_LOGON_INFO if needed
47 *
48 * we get device_sid from dissect_krb5_PAC_DEVICE_INFO if available.
49 *
50 * We remember these from the PAC and
51 * attach it to EncTicketPart_key so it
52 * might be valid if is_ticket_key is true.
53 *
54 * When learning a EncAPRepPart_subkey
55 * we copy the details from the EncTicketPart_key,
56 * so when is_ap_rep_key is true we may also have it.
57 *
58 * So application protocols like SMB2 could use the
59 * is_ap_rep_key=true key details in order to identify
60 * the authenticated user.
61 */
62 struct {
63 const char* account_name;
64 const char* account_domain;
65 const char* account_sid;
66 const char* device_sid;
67 } pac_names;
68 struct _enc_key_t* same_list;
69 unsigned num_same;
70 struct _enc_key_t* src1;
71 struct _enc_key_t* src2;
72} enc_key_t;
73
74WS_DLL_PUBLIC const enc_key_t* keytab_get_enc_key_list(void);
75WS_DLL_PUBLIC void keytab_set_enc_key_list(enc_key_t* list);
76WS_DLL_PUBLIC const wmem_map_t* keytab_get_file_longterm_keys(void);
77WS_DLL_PUBLIC wmem_map_t* keytab_get_file_all_keys(void);
78WS_DLL_PUBLIC wmem_map_t* keytab_get_file_session_keys(void);
79
80WS_DLL_PUBLIC void keytab_file_key_map_insert(wmem_map_t* key_map, enc_key_t* new_key);
81
82#endif /* defined(HAVE_HEIMDAL_KERBEROS) || defined(HAVE_MIT_KERBEROS) */
83
84#endif /* HAVE_KERBEROS */
85
92WS_DLL_LOCAL
93void keytab_file_data_init(void);
94
95#ifdef __cplusplus
96}
97#endif /* __cplusplus */
Definition wmem_map.c:60