comparison CSP2/CSP2_env/env-d9b9114564458d9d-741b3de822f2aaca6c6caa4325c4afce/include/libssh2_publickey.h @ 69:33d812a61356

planemo upload commit 2e9511a184a1ca667c7be0c6321a36dc4e3d116d
author jpayne
date Tue, 18 Mar 2025 17:55:14 -0400
parents
children
comparison
equal deleted inserted replaced
67:0e9998148a16 69:33d812a61356
1 /* Copyright (c) 2004-2006, Sara Golemon <sarag@libssh2.org>
2 * All rights reserved.
3 *
4 * Redistribution and use in source and binary forms,
5 * with or without modification, are permitted provided
6 * that the following conditions are met:
7 *
8 * Redistributions of source code must retain the above
9 * copyright notice, this list of conditions and the
10 * following disclaimer.
11 *
12 * Redistributions in binary form must reproduce the above
13 * copyright notice, this list of conditions and the following
14 * disclaimer in the documentation and/or other materials
15 * provided with the distribution.
16 *
17 * Neither the name of the copyright holder nor the names
18 * of any other contributors may be used to endorse or
19 * promote products derived from this software without
20 * specific prior written permission.
21 *
22 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
23 * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
24 * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
25 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
27 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
28 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
29 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
30 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
31 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
32 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
33 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
34 * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
35 * OF SUCH DAMAGE.
36 */
37
38 /* Note: This include file is only needed for using the
39 * publickey SUBSYSTEM which is not the same as publickey
40 * authentication. For authentication you only need libssh2.h
41 *
42 * For more information on the publickey subsystem,
43 * refer to IETF draft: secsh-publickey
44 */
45
46 #ifndef LIBSSH2_PUBLICKEY_H
47 #define LIBSSH2_PUBLICKEY_H 1
48
49 #include "libssh2.h"
50
51 typedef struct _LIBSSH2_PUBLICKEY LIBSSH2_PUBLICKEY;
52
53 typedef struct _libssh2_publickey_attribute {
54 const char *name;
55 unsigned long name_len;
56 const char *value;
57 unsigned long value_len;
58 char mandatory;
59 } libssh2_publickey_attribute;
60
61 typedef struct _libssh2_publickey_list {
62 unsigned char *packet; /* For freeing */
63
64 const unsigned char *name;
65 unsigned long name_len;
66 const unsigned char *blob;
67 unsigned long blob_len;
68 unsigned long num_attrs;
69 libssh2_publickey_attribute *attrs; /* free me */
70 } libssh2_publickey_list;
71
72 /* Generally use the first macro here, but if both name and value are string
73 literals, you can use _fast() to take advantage of preprocessing */
74 #define libssh2_publickey_attribute(name, value, mandatory) \
75 { (name), strlen(name), (value), strlen(value), (mandatory) },
76 #define libssh2_publickey_attribute_fast(name, value, mandatory) \
77 { (name), sizeof(name) - 1, (value), sizeof(value) - 1, (mandatory) },
78
79 #ifdef __cplusplus
80 extern "C" {
81 #endif
82
83 /* Publickey Subsystem */
84 LIBSSH2_API LIBSSH2_PUBLICKEY *
85 libssh2_publickey_init(LIBSSH2_SESSION *session);
86
87 LIBSSH2_API int
88 libssh2_publickey_add_ex(LIBSSH2_PUBLICKEY *pkey,
89 const unsigned char *name,
90 unsigned long name_len,
91 const unsigned char *blob,
92 unsigned long blob_len, char overwrite,
93 unsigned long num_attrs,
94 const libssh2_publickey_attribute attrs[]);
95 #define libssh2_publickey_add(pkey, name, blob, blob_len, overwrite, \
96 num_attrs, attrs) \
97 libssh2_publickey_add_ex((pkey), (name), strlen(name), (blob), (blob_len), \
98 (overwrite), (num_attrs), (attrs))
99
100 LIBSSH2_API int libssh2_publickey_remove_ex(LIBSSH2_PUBLICKEY *pkey,
101 const unsigned char *name,
102 unsigned long name_len,
103 const unsigned char *blob,
104 unsigned long blob_len);
105 #define libssh2_publickey_remove(pkey, name, blob, blob_len) \
106 libssh2_publickey_remove_ex((pkey), (name), strlen(name), (blob), (blob_len))
107
108 LIBSSH2_API int
109 libssh2_publickey_list_fetch(LIBSSH2_PUBLICKEY *pkey,
110 unsigned long *num_keys,
111 libssh2_publickey_list **pkey_list);
112 LIBSSH2_API void
113 libssh2_publickey_list_free(LIBSSH2_PUBLICKEY *pkey,
114 libssh2_publickey_list *pkey_list);
115
116 LIBSSH2_API int libssh2_publickey_shutdown(LIBSSH2_PUBLICKEY *pkey);
117
118 #ifdef __cplusplus
119 } /* extern "C" */
120 #endif
121
122 #endif /* ifndef: LIBSSH2_PUBLICKEY_H */