Wireshark 4.7.0
The Wireshark network protocol analyzer
Loading...
Searching...
No Matches
secrets.h
Go to the documentation of this file.
1
12#ifndef __SECRETS_H__
13#define __SECRETS_H__
14
15#include <inttypes.h>
16#include <stdbool.h>
17
18#include <glib.h>
19#include "ws_symbol_export.h"
20#include "cfile.h"
21
22#ifdef __cplusplus
23extern "C" {
24#endif /* __cplusplus */
25
41void secrets_init(void);
42void secrets_cleanup(void);
43
44#if 0
51enum secrets_scope {
52 SECRETS_SCOPE_EPAN,
53 SECRETS_SCOPE_FILE,
54};
55#endif
56
57#ifdef HAVE_LIBGNUTLS
59struct cert_key_id {
60 uint8_t key_id[20];
61};
62typedef struct cert_key_id cert_key_id_t;
63#endif /* HAVE_LIBGNUTLS */
64
65
69WS_DLL_PUBLIC void
70secrets_wtap_callback(uint32_t secrets_type, const void *secrets, unsigned size);
71
75typedef void (*secrets_block_callback_t)(const void *secrets, unsigned size);
76
84WS_DLL_PUBLIC void
85secrets_register_type(uint32_t secrets_type, secrets_block_callback_t cb);
86
87typedef unsigned (*secret_inject_count_func)(void);
88typedef bool (*secret_inject_export_func)(capture_file* cf);
89typedef char* (*secret_export_func)(size_t* length);
90
99WS_DLL_PUBLIC void
100secrets_register_inject_type(const char* name, secret_inject_count_func count_func, secret_inject_export_func inject_func, secret_export_func export_func);
101
102typedef enum {
103 SECRETS_EXPORT_SUCCESS = 0,
104 SECRETS_INVALID_CAPTURE_FILE,
105 SECRETS_UNKNOWN_PROTOCOL,
106 SECRETS_NO_SECRETS,
107 SECRETS_EXPORT_FAILED,
108} secrets_export_values;
109
116WS_DLL_PUBLIC unsigned
117secrets_get_count(const char* name);
118
127WS_DLL_PUBLIC secrets_export_values
128secrets_export_dsb(const char* name, capture_file* cf);
129
139WS_DLL_PUBLIC secrets_export_values
140secrets_export(const char* name, char** secrets, size_t* secrets_len, unsigned* num_secrets);
141
149WS_DLL_PUBLIC void
150secrets_inject_foreach(GHFunc func, void* param);
151
152
153#ifdef HAVE_LIBGNUTLS
160WS_DLL_PUBLIC GSList *
161secrets_get_available_keys(void);
162
172WS_DLL_PUBLIC bool
173secrets_verify_key(const char *uri, const char *password, bool *need_password, char **error);
174
176GHashTable *privkey_hash_table_new(void);
177
190WS_DLL_PUBLIC int
191secrets_rsa_decrypt(const cert_key_id_t *key_id, const uint8_t *encr, unsigned encr_len, uint8_t **out, unsigned *out_len);
192#endif /* HAVE_LIBGNUTLS */
193
194#ifdef __cplusplus
195}
196#endif /* __cplusplus */
197
198#endif /* __SECRETS_H__ */
WS_DLL_PUBLIC void secrets_wtap_callback(uint32_t secrets_type, const void *secrets, unsigned size)
Definition secrets.c:183
void(* secrets_block_callback_t)(const void *secrets, unsigned size)
Definition secrets.h:75
void secrets_init(void)
Definition secrets.c:80
WS_DLL_PUBLIC void secrets_register_type(uint32_t secrets_type, secrets_block_callback_t cb)
Definition secrets.c:108
WS_DLL_PUBLIC secrets_export_values secrets_export_dsb(const char *name, capture_file *cf)
Definition secrets.c:136
WS_DLL_PUBLIC void secrets_inject_foreach(GHFunc func, void *param)
Definition secrets.c:177
WS_DLL_PUBLIC void secrets_register_inject_type(const char *name, secret_inject_count_func count_func, secret_inject_export_func inject_func, secret_export_func export_func)
Definition secrets.c:114
WS_DLL_PUBLIC secrets_export_values secrets_export(const char *name, char **secrets, size_t *secrets_len, unsigned *num_secrets)
Definition secrets.c:155
WS_DLL_PUBLIC unsigned secrets_get_count(const char *name)
Definition secrets.c:126
Definition cfile.h:67