libssh: keys.h Source File

libssh 0.10.6 The SSH library

Loading...
Searching...
No Matches
keys.h
1/*
2 * This file is part of the SSH Library
3 *
4 * Copyright (c) 2009 by Aris Adamantiadis
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 */
20
21#ifndef KEYS_H_
22#define KEYS_H_
23
24#include "config.h"
25#include "libssh/libssh.h"
26#include "libssh/wrapper.h"
27
28 struct ssh_public_key_struct {
29 int type;
30 const char *type_c; /* Don't free it ! it is static */
31#if defined(HAVE_LIBGCRYPT)
32 gcry_sexp_t dsa_pub;
33 gcry_sexp_t rsa_pub;
34#elif defined(HAVE_LIBCRYPTO)
35#if OPENSSL_VERSION_NUMBER < 0x30000000L
36 DSA *dsa_pub;
37 RSA *rsa_pub;
38#else /* OPENSSL_VERSION_NUMBER */
39 EVP_PKEY *key_pub;
40#endif
41#elif defined(HAVE_LIBMBEDCRYPTO)
42 mbedtls_pk_context *rsa_pub;
43 void *dsa_pub;
44#endif
45};
46
47 struct ssh_private_key_struct {
48 int type;
49#if defined(HAVE_LIBGCRYPT)
50 gcry_sexp_t dsa_priv;
51 gcry_sexp_t rsa_priv;
52#elif defined(HAVE_LIBCRYPTO)
53#if OPENSSL_VERSION_NUMBER < 0x30000000L
54 DSA *dsa_priv;
55 RSA *rsa_priv;
56#else
57 EVP_PKEY *key_priv;
58#endif /* OPENSSL_VERSION_NUMBER */
59#elif defined(HAVE_LIBMBEDCRYPTO)
60 mbedtls_pk_context *rsa_priv;
61 void *dsa_priv;
62#endif
63};
64
65#ifdef __cplusplus
66extern "C" {
67#endif
68
69const char *ssh_type_to_char(int type);
70int ssh_type_from_name(const char *name);
71
72 ssh_public_key publickey_from_string(ssh_session session, ssh_string pubkey_s);
73
74#ifdef __cplusplus
75}
76#endif
77
78#endif /* KEYS_H_ */
ssh_private_key_struct
Definition keys.h:47
ssh_public_key_struct
Definition keys.h:28
ssh_session_struct
Definition session.h:127
ssh_string_struct
Definition string.h:33