libssh  0.5.4
pki.h
1 /*
2  * This file is part of the SSH Library
3  *
4  * Copyright (c) 2010 by Aris Adamantiadis
5  *
6  * The SSH Library is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU Lesser General Public License as published by
8  * the Free Software Foundation; either version 2.1 of the License, or (at your
9  * option) any later version.
10  *
11  * The SSH Library is distributed in the hope that it will be useful, but
12  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13  * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
14  * License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public License
17  * along with the SSH Library; see the file COPYING. If not, write to
18  * the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
19  * MA 02111-1307, USA.
20  */
21 
22 #ifndef PKI_H_
23 #define PKI_H_
24 
25 #define SSH_KEY_FLAG_EMPTY 0
26 #define SSH_KEY_FLAG_PUBLIC 1
27 #define SSH_KEY_FLAG_PRIVATE 2
28 
29 struct ssh_key_struct {
30  enum ssh_keytypes_e type;
31  int flags;
32  const char *type_c; /* Don't free it ! it is static */
33 #ifdef HAVE_LIBGCRYPT
34  gcry_sexp_t dsa;
35  gcry_sexp_t rsa;
36 #elif HAVE_LIBCRYPTO
37  DSA *dsa;
38  RSA *rsa;
39 #endif
40 };
41 
42 ssh_key ssh_key_new (void);
43 void ssh_key_clean (ssh_key key);
44 enum ssh_keytypes_e ssh_key_type(ssh_key key);
45 int ssh_key_import_private(ssh_key key, ssh_session session,
46  const char *filename, const char *passphrase);
47 void ssh_key_free (ssh_key key);
48 
49 #endif /* PKI_H_ */