libssh 0.5.2

include/libssh/agent.h

00001 #ifndef __AGENT_H
00002 #define __AGENT_H
00003 
00004 #include "libssh/libssh.h"
00005 
00006 /* Messages for the authentication agent connection. */
00007 #define SSH_AGENTC_REQUEST_RSA_IDENTITIES        1
00008 #define SSH_AGENT_RSA_IDENTITIES_ANSWER          2
00009 #define SSH_AGENTC_RSA_CHALLENGE                 3
00010 #define SSH_AGENT_RSA_RESPONSE                   4
00011 #define SSH_AGENT_FAILURE                        5
00012 #define SSH_AGENT_SUCCESS                        6
00013 #define SSH_AGENTC_ADD_RSA_IDENTITY              7
00014 #define SSH_AGENTC_REMOVE_RSA_IDENTITY           8
00015 #define SSH_AGENTC_REMOVE_ALL_RSA_IDENTITIES     9
00016 
00017 /* private OpenSSH extensions for SSH2 */
00018 #define SSH2_AGENTC_REQUEST_IDENTITIES           11
00019 #define SSH2_AGENT_IDENTITIES_ANSWER             12
00020 #define SSH2_AGENTC_SIGN_REQUEST                 13
00021 #define SSH2_AGENT_SIGN_RESPONSE                 14
00022 #define SSH2_AGENTC_ADD_IDENTITY                 17
00023 #define SSH2_AGENTC_REMOVE_IDENTITY              18
00024 #define SSH2_AGENTC_REMOVE_ALL_IDENTITIES        19
00025 
00026 /* smartcard */
00027 #define SSH_AGENTC_ADD_SMARTCARD_KEY             20
00028 #define SSH_AGENTC_REMOVE_SMARTCARD_KEY          21
00029 
00030 /* lock/unlock the agent */
00031 #define SSH_AGENTC_LOCK                          22
00032 #define SSH_AGENTC_UNLOCK                        23
00033 
00034 /* add key with constraints */
00035 #define SSH_AGENTC_ADD_RSA_ID_CONSTRAINED        24
00036 #define SSH2_AGENTC_ADD_ID_CONSTRAINED           25
00037 #define SSH_AGENTC_ADD_SMARTCARD_KEY_CONSTRAINED 26
00038 
00039 #define SSH_AGENT_CONSTRAIN_LIFETIME             1
00040 #define SSH_AGENT_CONSTRAIN_CONFIRM              2
00041 
00042 /* extended failure messages */
00043 #define SSH2_AGENT_FAILURE                       30
00044 
00045 /* additional error code for ssh.com's ssh-agent2 */
00046 #define SSH_COM_AGENT2_FAILURE                   102
00047 
00048 #define SSH_AGENT_OLD_SIGNATURE                  0x01
00049 
00050 struct ssh_agent_struct {
00051   struct ssh_socket_struct *sock;
00052   ssh_buffer ident;
00053   unsigned int count;
00054 };
00055 
00056 #ifndef _WIN32
00057 /* agent.c */
00063 struct ssh_agent_struct *agent_new(struct ssh_session_struct *session);
00064 
00065 void agent_close(struct ssh_agent_struct *agent);
00066 
00072 void agent_free(struct ssh_agent_struct *agent);
00073 
00081 int agent_is_running(struct ssh_session_struct *session);
00082 
00083 int agent_get_ident_count(struct ssh_session_struct *session);
00084 
00085 struct ssh_public_key_struct *agent_get_next_ident(struct ssh_session_struct *session,
00086     char **comment);
00087 
00088 struct ssh_public_key_struct *agent_get_first_ident(struct ssh_session_struct *session,
00089     char **comment);
00090 
00091 ssh_string agent_sign_data(struct ssh_session_struct *session,
00092     struct ssh_buffer_struct *data,
00093     struct ssh_public_key_struct *pubkey);
00094 #endif
00095 
00096 #endif /* __AGENT_H */
00097 /* vim: set ts=2 sw=2 et cindent: */