libssh 0.7.3

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 #ifdef HAVE_LIBGCRYPT
32 gcry_sexp_t dsa_pub;
33 gcry_sexp_t rsa_pub;
34 #elif HAVE_LIBCRYPTO
35 DSA *dsa_pub;
36 RSA *rsa_pub;
37 #endif
38 };
39
40 struct ssh_private_key_struct {
41 int type;
42 #ifdef HAVE_LIBGCRYPT
43 gcry_sexp_t dsa_priv;
44 gcry_sexp_t rsa_priv;
45 #elif defined HAVE_LIBCRYPTO
46 DSA *dsa_priv;
47 RSA *rsa_priv;
48 #endif
49 };
50
51 const char *ssh_type_to_char(int type);
52 int ssh_type_from_name(const char *name);
53
54 ssh_public_key publickey_from_string(ssh_session session, ssh_string pubkey_s);
55
56 #endif /* KEYS_H_ */