libssh  0.5.4
agent.h
1 #ifndef __AGENT_H
2 #define __AGENT_H
3 
4 #include "libssh/libssh.h"
5 
6 /* Messages for the authentication agent connection. */
7 #define SSH_AGENTC_REQUEST_RSA_IDENTITIES 1
8 #define SSH_AGENT_RSA_IDENTITIES_ANSWER 2
9 #define SSH_AGENTC_RSA_CHALLENGE 3
10 #define SSH_AGENT_RSA_RESPONSE 4
11 #define SSH_AGENT_FAILURE 5
12 #define SSH_AGENT_SUCCESS 6
13 #define SSH_AGENTC_ADD_RSA_IDENTITY 7
14 #define SSH_AGENTC_REMOVE_RSA_IDENTITY 8
15 #define SSH_AGENTC_REMOVE_ALL_RSA_IDENTITIES 9
16 
17 /* private OpenSSH extensions for SSH2 */
18 #define SSH2_AGENTC_REQUEST_IDENTITIES 11
19 #define SSH2_AGENT_IDENTITIES_ANSWER 12
20 #define SSH2_AGENTC_SIGN_REQUEST 13
21 #define SSH2_AGENT_SIGN_RESPONSE 14
22 #define SSH2_AGENTC_ADD_IDENTITY 17
23 #define SSH2_AGENTC_REMOVE_IDENTITY 18
24 #define SSH2_AGENTC_REMOVE_ALL_IDENTITIES 19
25 
26 /* smartcard */
27 #define SSH_AGENTC_ADD_SMARTCARD_KEY 20
28 #define SSH_AGENTC_REMOVE_SMARTCARD_KEY 21
29 
30 /* lock/unlock the agent */
31 #define SSH_AGENTC_LOCK 22
32 #define SSH_AGENTC_UNLOCK 23
33 
34 /* add key with constraints */
35 #define SSH_AGENTC_ADD_RSA_ID_CONSTRAINED 24
36 #define SSH2_AGENTC_ADD_ID_CONSTRAINED 25
37 #define SSH_AGENTC_ADD_SMARTCARD_KEY_CONSTRAINED 26
38 
39 #define SSH_AGENT_CONSTRAIN_LIFETIME 1
40 #define SSH_AGENT_CONSTRAIN_CONFIRM 2
41 
42 /* extended failure messages */
43 #define SSH2_AGENT_FAILURE 30
44 
45 /* additional error code for ssh.com's ssh-agent2 */
46 #define SSH_COM_AGENT2_FAILURE 102
47 
48 #define SSH_AGENT_OLD_SIGNATURE 0x01
49 
50 struct ssh_agent_struct {
51  struct ssh_socket_struct *sock;
52  ssh_buffer ident;
53  unsigned int count;
54 };
55 
56 #ifndef _WIN32
57 /* agent.c */
63 struct ssh_agent_struct *agent_new(struct ssh_session_struct *session);
64 
65 void agent_close(struct ssh_agent_struct *agent);
66 
72 void agent_free(struct ssh_agent_struct *agent);
73 
81 int agent_is_running(struct ssh_session_struct *session);
82 
83 int agent_get_ident_count(struct ssh_session_struct *session);
84 
85 struct ssh_public_key_struct *agent_get_next_ident(struct ssh_session_struct *session,
86  char **comment);
87 
88 struct ssh_public_key_struct *agent_get_first_ident(struct ssh_session_struct *session,
89  char **comment);
90 
91 ssh_string agent_sign_data(struct ssh_session_struct *session,
92  struct ssh_buffer_struct *data,
93  struct ssh_public_key_struct *pubkey);
94 #endif
95 
96 #endif /* __AGENT_H */
97 /* vim: set ts=2 sw=2 et cindent: */