libssh  0.5.2
include/libssh/pki.h
00001 /*
00002  * This file is part of the SSH Library
00003  *
00004  * Copyright (c) 2010 by Aris Adamantiadis
00005  *
00006  * The SSH Library is free software; you can redistribute it and/or modify
00007  * it under the terms of the GNU Lesser General Public License as published by
00008  * the Free Software Foundation; either version 2.1 of the License, or (at your
00009  * option) any later version.
00010  *
00011  * The SSH Library is distributed in the hope that it will be useful, but
00012  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
00013  * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
00014  * License for more details.
00015  *
00016  * You should have received a copy of the GNU Lesser General Public License
00017  * along with the SSH Library; see the file COPYING.  If not, write to
00018  * the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
00019  * MA 02111-1307, USA.
00020  */
00021 
00022 #ifndef PKI_H_
00023 #define PKI_H_
00024 
00025 #define SSH_KEY_FLAG_EMPTY 0
00026 #define SSH_KEY_FLAG_PUBLIC  1
00027 #define SSH_KEY_FLAG_PRIVATE 2
00028 
00029 struct ssh_key_struct {
00030     enum ssh_keytypes_e type;
00031     int flags;
00032     const char *type_c; /* Don't free it ! it is static */
00033 #ifdef HAVE_LIBGCRYPT
00034     gcry_sexp_t dsa;
00035     gcry_sexp_t rsa;
00036 #elif HAVE_LIBCRYPTO
00037     DSA *dsa;
00038     RSA *rsa;
00039 #endif
00040 };
00041 
00042 ssh_key ssh_key_new (void);
00043 void ssh_key_clean (ssh_key key);
00044 enum ssh_keytypes_e ssh_key_type(ssh_key key);
00045 int ssh_key_import_private(ssh_key key, ssh_session session,
00046     const char *filename, const char *passphrase);
00047 void ssh_key_free (ssh_key key);
00048 
00049 #endif /* PKI_H_ */