00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef KEYS_H_
00023 #define KEYS_H_
00024
00025 #include "config.h"
00026 #include "libssh/libssh.h"
00027 #include "libssh/wrapper.h"
00028
00029 struct ssh_public_key_struct {
00030 int type;
00031 const char *type_c;
00032 #ifdef HAVE_LIBGCRYPT
00033 gcry_sexp_t dsa_pub;
00034 gcry_sexp_t rsa_pub;
00035 #elif HAVE_LIBCRYPTO
00036 DSA *dsa_pub;
00037 RSA *rsa_pub;
00038 #endif
00039 };
00040
00041 struct ssh_private_key_struct {
00042 int type;
00043 #ifdef HAVE_LIBGCRYPT
00044 gcry_sexp_t dsa_priv;
00045 gcry_sexp_t rsa_priv;
00046 #elif defined HAVE_LIBCRYPTO
00047 DSA *dsa_priv;
00048 RSA *rsa_priv;
00049 #endif
00050 };
00051
00052 typedef struct signature_struct {
00053 int type;
00054 #ifdef HAVE_LIBGCRYPT
00055 gcry_sexp_t dsa_sign;
00056 gcry_sexp_t rsa_sign;
00057 #elif defined HAVE_LIBCRYPTO
00058 DSA_SIG *dsa_sign;
00059 ssh_string rsa_sign;
00060 #endif
00061 } SIGNATURE;
00062
00063 const char *ssh_type_to_char(int type);
00064 int ssh_type_from_name(const char *name);
00065 ssh_buffer ssh_userauth_build_digest(ssh_session session, ssh_message msg, char *service);
00066
00067 ssh_private_key privatekey_make_dss(ssh_session session, ssh_buffer buffer);
00068 ssh_private_key privatekey_make_rsa(ssh_session session, ssh_buffer buffer,
00069 const char *type);
00070 ssh_private_key privatekey_from_string(ssh_session session, ssh_string privkey_s);
00071
00072 ssh_public_key publickey_make_dss(ssh_session session, ssh_buffer buffer);
00073 ssh_public_key publickey_make_rsa(ssh_session session, ssh_buffer buffer, int type);
00074 ssh_public_key publickey_from_string(ssh_session session, ssh_string pubkey_s);
00075 SIGNATURE *signature_from_string(ssh_session session, ssh_string signature,ssh_public_key pubkey,int needed_type);
00076 void signature_free(SIGNATURE *sign);
00077 ssh_string ssh_do_sign_with_agent(struct ssh_session_struct *session,
00078 struct ssh_buffer_struct *buf, struct ssh_public_key_struct *publickey);
00079 ssh_string ssh_do_sign(ssh_session session,ssh_buffer sigbuf,
00080 ssh_private_key privatekey);
00081 ssh_string ssh_sign_session_id(ssh_session session, ssh_private_key privatekey);
00082 ssh_string ssh_encrypt_rsa1(ssh_session session, ssh_string data, ssh_public_key key);
00083
00084 #endif