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