libssh: /build/libssh/src/libssh-0.12.2/include/libssh/agent.h Source File

libssh 0.12.2 The SSH library

Loading...
Searching...
No Matches
agent.h
1/*
2 * This file is part of the SSH Library
3 *
4 * Copyright (c) 2008-2009 Andreas Schneider <asn@cryptomilk.org>
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 */
20
21#ifndef __AGENT_H
22#define __AGENT_H
23
24#include "libssh/libssh.h"
25
26/* Messages for the authentication agent connection. */
27#define SSH_AGENTC_REQUEST_RSA_IDENTITIES 1
28#define SSH_AGENT_RSA_IDENTITIES_ANSWER 2
29#define SSH_AGENTC_RSA_CHALLENGE 3
30#define SSH_AGENT_RSA_RESPONSE 4
31#define SSH_AGENT_FAILURE 5
32#define SSH_AGENT_SUCCESS 6
33#define SSH_AGENTC_ADD_RSA_IDENTITY 7
34#define SSH_AGENTC_REMOVE_RSA_IDENTITY 8
35#define SSH_AGENTC_REMOVE_ALL_RSA_IDENTITIES 9
36
37/* private OpenSSH extensions for SSH2 */
38#define SSH2_AGENTC_REQUEST_IDENTITIES 11
39#define SSH2_AGENT_IDENTITIES_ANSWER 12
40#define SSH2_AGENTC_SIGN_REQUEST 13
41#define SSH2_AGENT_SIGN_RESPONSE 14
42#define SSH2_AGENTC_ADD_IDENTITY 17
43#define SSH2_AGENTC_REMOVE_IDENTITY 18
44#define SSH2_AGENTC_REMOVE_ALL_IDENTITIES 19
45
46/* smartcard */
47#define SSH_AGENTC_ADD_SMARTCARD_KEY 20
48#define SSH_AGENTC_REMOVE_SMARTCARD_KEY 21
49
50/* lock/unlock the agent */
51#define SSH_AGENTC_LOCK 22
52#define SSH_AGENTC_UNLOCK 23
53
54/* add key with constraints */
55#define SSH_AGENTC_ADD_RSA_ID_CONSTRAINED 24
56#define SSH2_AGENTC_ADD_ID_CONSTRAINED 25
57#define SSH_AGENTC_ADD_SMARTCARD_KEY_CONSTRAINED 26
58
59#define SSH_AGENT_CONSTRAIN_LIFETIME 1
60#define SSH_AGENT_CONSTRAIN_CONFIRM 2
61
62/* extended failure messages */
63#define SSH2_AGENT_FAILURE 30
64
65/* additional error code for ssh.com's ssh-agent2 */
66#define SSH_COM_AGENT2_FAILURE 102
67
68#define SSH_AGENT_OLD_SIGNATURE 0x01
69/* Signature flags from draft-miller-ssh-agent-02 */
70#define SSH_AGENT_RSA_SHA2_256 0x02
71#define SSH_AGENT_RSA_SHA2_512 0x04
72
73#ifdef __cplusplus
74extern "C" {
75#endif
76
77struct ssh_agent_struct {
78 struct ssh_socket_struct *sock;
79 ssh_buffer ident;
80 unsigned int count;
81 ssh_channel channel;
82};
83
84/* agent.c */
90struct ssh_agent_struct *ssh_agent_new(struct ssh_session_struct *session);
91
92void ssh_agent_close(struct ssh_agent_struct *agent);
93
99void ssh_agent_free(struct ssh_agent_struct *agent);
100
108int ssh_agent_is_running(struct ssh_session_struct *session);
109
110uint32_t ssh_agent_get_ident_count(struct ssh_session_struct *session);
111
112ssh_key ssh_agent_get_next_ident(struct ssh_session_struct *session,
113 char **comment);
114
115ssh_key ssh_agent_get_first_ident(struct ssh_session_struct *session,
116 char **comment);
117
118ssh_string ssh_agent_sign_data(ssh_session session,
119 const ssh_key pubkey,
120 struct ssh_buffer_struct *data);
121
122#ifdef __cplusplus
123}
124#endif
125
126#endif /* __AGENT_H */