TODO epan/dissectors/asn1/kerberos/packet-kerberos-template.c new GSS flags
[wireshark-sm.git] / wsutil / rsa.h
blob8381704833ade596b5a490bd4b827e03be3184fa
1 /** @file
3 * Functions for RSA private key reading and use
5 * Wireshark - Network traffic analyzer
6 * By Gerald Combs <gerald@wireshark.org>
7 * Copyright 2007 Gerald Combs
9 * SPDX-License-Identifier: GPL-2.0-or-later
12 #ifndef __RSA_H__
13 #define __RSA_H__
15 #include <wireshark.h>
16 #include <gcrypt.h>
18 #ifdef HAVE_LIBGNUTLS
19 #include <stdio.h>
20 #include <gnutls/abstract.h>
21 WS_DLL_PUBLIC gcry_sexp_t rsa_privkey_to_sexp(gnutls_x509_privkey_t priv_key, char **err);
23 /**
24 * Load an RSA private key from specified file
25 * @param fp the file that contain the key data
26 * @param [out] err error message upon failure; NULL upon success
27 * @return a pointer to the loaded key on success, or NULL upon failure
29 WS_DLL_PUBLIC gnutls_x509_privkey_t rsa_load_pem_key(FILE* fp, char **err);
31 /**
32 * Load a RSA private key from a PKCS#12 file (DER or PEM format)
33 * @param fp the file that contains the key data
34 * @param cert_passwd password to decrypt the PKCS#12 file
35 * @param [out] err error message upon failure; NULL upon success
36 * @return a pointer to the loaded key on success; NULL upon failure
38 WS_DLL_PUBLIC gnutls_x509_privkey_t rsa_load_pkcs12(FILE* fp, const char *cert_passwd, char** err);
39 #endif
41 WS_DLL_PUBLIC void rsa_private_key_free(void * key);
44 #endif /* __RSA_H__ */