libssh  0.7.2
include/libssh/keys.h
00001 /*
00002  * This file is part of the SSH Library
00003  *
00004  * Copyright (c) 2009 by Aris Adamantiadis
00005  *
00006  * This library is free software; you can redistribute it and/or
00007  * modify it under the terms of the GNU Lesser General Public
00008  * License as published by the Free Software Foundation; either
00009  * version 2.1 of the License, or (at your option) any later version.
00010  *
00011  * This library is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014  * Lesser General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU Lesser General Public
00017  * License along with this library; if not, write to the Free Software
00018  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
00019  */
00020 
00021 #ifndef KEYS_H_
00022 #define KEYS_H_
00023 
00024 #include "config.h"
00025 #include "libssh/libssh.h"
00026 #include "libssh/wrapper.h"
00027 
00028 struct ssh_public_key_struct {
00029     int type;
00030     const char *type_c; /* Don't free it ! it is static */
00031 #ifdef HAVE_LIBGCRYPT
00032     gcry_sexp_t dsa_pub;
00033     gcry_sexp_t rsa_pub;
00034 #elif HAVE_LIBCRYPTO
00035     DSA *dsa_pub;
00036     RSA *rsa_pub;
00037 #endif
00038 };
00039 
00040 struct ssh_private_key_struct {
00041     int type;
00042 #ifdef HAVE_LIBGCRYPT
00043     gcry_sexp_t dsa_priv;
00044     gcry_sexp_t rsa_priv;
00045 #elif defined HAVE_LIBCRYPTO
00046     DSA *dsa_priv;
00047     RSA *rsa_priv;
00048 #endif
00049 };
00050 
00051 const char *ssh_type_to_char(int type);
00052 int ssh_type_from_name(const char *name);
00053 
00054 ssh_public_key publickey_from_string(ssh_session session, ssh_string pubkey_s);
00055 
00056 #endif /* KEYS_H_ */