mirror of
				https://github.com/libssh2/libssh2.git
				synced 2025-11-03 22:13:11 +03:00 
			
		
		
		
	Add new `libssh2_session_callback_set2()` API that deprecates `libssh2_session_callback_set()`. The new implementation offers the same functionality, but accepts and returns a generic function pointer (of type `libssh2_cb_generic *`), as opposed to the old function that used data pointers (`void *`). The new solution thus avoids data to function (and vice versa) pointer conversions, which has undefined behaviour in standard C. About the name: It seems the `*2` suffix was used in the past for replacement functions for deprecated ones. Let's stick with that. `*_ex` was preferred for new functions that extend existing ones with new features. Closes #1285
		
			
				
	
	
		
			55 lines
		
	
	
		
			1.8 KiB
		
	
	
	
		
			Groff
		
	
	
	
	
	
			
		
		
	
	
			55 lines
		
	
	
		
			1.8 KiB
		
	
	
	
		
			Groff
		
	
	
	
	
	
.\" Copyright (C) The libssh2 project and its contributors.
 | 
						|
.\" SPDX-License-Identifier: BSD-3-Clause
 | 
						|
.TH libssh2_agent_sign 3 "1 Oct 2022" "libssh2" "libssh2"
 | 
						|
.SH NAME
 | 
						|
libssh2_agent_sign - sign data, with the help of ssh-agent
 | 
						|
.SH SYNOPSIS
 | 
						|
.nf
 | 
						|
#include <libssh2.h>
 | 
						|
 | 
						|
int
 | 
						|
libssh2_agent_sign(LIBSSH2_AGENT *agent,
 | 
						|
                   struct libssh2_agent_publickey *identity,
 | 
						|
                   unsigned char **sig,
 | 
						|
                   size_t *s_len,
 | 
						|
                   const unsigned char *data,
 | 
						|
                   size_t d_len,
 | 
						|
                   const char *method,
 | 
						|
                   unsigned int method_len);
 | 
						|
.fi
 | 
						|
.SH DESCRIPTION
 | 
						|
\fIagent\fP - ssh-agent handle as returned by
 | 
						|
.BR libssh2_agent_init(3)
 | 
						|
 | 
						|
\fIidentity\fP - Public key to authenticate with, as returned by
 | 
						|
.BR libssh2_agent_get_identity(3)
 | 
						|
 | 
						|
\fIsig\fP - A pointer to a buffer in which to place the signature. The caller
 | 
						|
is responsible for freeing the signature with LIBSSH2_FREE.
 | 
						|
 | 
						|
\fIs_len\fP - A pointer to the length of the sig parameter.
 | 
						|
 | 
						|
\fIdata\fP - The data to sign.
 | 
						|
 | 
						|
\fId_len\fP - The length of the data parameter.
 | 
						|
 | 
						|
\fImethod\fP - A buffer indicating the signing method. This should match the
 | 
						|
string at the start of identity->blob.
 | 
						|
 | 
						|
\fImethod_len\fP - The length of the method parameter.
 | 
						|
 | 
						|
Sign data using an ssh-agent. This function can be used in a callback
 | 
						|
registered with libssh2_session_callback_set2(3) using
 | 
						|
LIBSSH2_CALLBACK_AUTHAGENT_SIGN to sign an authentication challenge from a
 | 
						|
server. However, the client is responsible for implementing the code that calls
 | 
						|
this callback in response to a SSH2_AGENTC_SIGN_REQUEST message.
 | 
						|
.SH RETURN VALUE
 | 
						|
Returns 0 if succeeded, or a negative value for error.
 | 
						|
.SH AVAILABILITY
 | 
						|
Added in libssh2 1.11.0
 | 
						|
.SH SEE ALSO
 | 
						|
.BR libssh2_agent_init(3)
 | 
						|
.BR libssh2_agent_get_identity(3)
 | 
						|
.BR libssh2_agent_userauth(3)
 | 
						|
.BR libssh2_session_callback_set2(3)
 |