Exemple #1
0
        public unsafe static SshKeyHandle?ssh_get_server_publickey(SessionHandle session)
        {
            IntPtr pkey;
            int    rv = ssh_get_server_publickey(session, &pkey);

            return(rv == SSH_OK ? new SshKeyHandle(pkey, ownsHandle: true) : null);
        }
Exemple #2
0
 public unsafe static bool ssh_options_set(SessionHandle session, SshOption option, string value)
 {
     // TODO: stackalloc
     fixed(byte *p = Encoding.UTF8.GetBytes(value))
     {
         return(ssh_options_set(session, option, new IntPtr(p)) == 0);
     }
 }
Exemple #3
0
 public static IntPtr ssh_get_fd(SessionHandle session)
 {
     if (Platform.IsWindows)
     {
         return(ssh_get_fd_windows(session));
     }
     else
     {
         return(new IntPtr(ssh_get_fd_unix(session)));
     }
 }
Exemple #4
0
 public static extern int ssh_options_set(SessionHandle session, SshOption option, IntPtr value);
Exemple #5
0
 public static extern AuthResult ssh_userauth_publickey(SessionHandle session, string?username, SshKeyHandle privkey);
Exemple #6
0
 public static extern PollFlags ssh_get_poll_flags(SessionHandle session);
Exemple #7
0
 public static bool ssh_get_error_is_fatal(SessionHandle session)
 => ssh_get_error_code(session) == SSH_FATAL;
Exemple #8
0
 public static string ssh_get_error(SessionHandle session)
 {
     return(Marshal.PtrToStringAnsi(ssh_get_error_(session)) ?? "Uknown error.");
 }
Exemple #9
0
 public static extern AuthResult ssh_userauth_password(SessionHandle session, string username, string password);
Exemple #10
0
 public static extern KnownHostResult ssh_session_is_known_server(SessionHandle session);
Exemple #11
0
 public static extern AuthResult ssh_userauth_publickey_auto(SessionHandle session, string?username, string?passphrase);
Exemple #12
0
 public static extern int ssh_event_remove_session(EventHandle @event, SessionHandle session);
Exemple #13
0
 public static extern int ssh_blocking_flush(SessionHandle session, int timeout);
Exemple #14
0
 private static extern int ssh_get_fd_unix(SessionHandle session);
Exemple #15
0
 private static extern IntPtr ssh_get_fd_windows(SessionHandle session);
Exemple #16
0
 public unsafe static bool ssh_options_set(SessionHandle session, SshOption option, uint value)
 {
     return(ssh_options_set(session, option, new IntPtr(&value)) == 0);
 }
Exemple #17
0
 public static extern int ssh_disconnect(SessionHandle session);
Exemple #18
0
 private static extern int ssh_is_connected_(SessionHandle session);
Exemple #19
0
 public static extern IntPtr ssh_get_error_(SessionHandle session);
Exemple #20
0
 public static bool ssh_is_connected(SessionHandle session)
 {
     return(ssh_is_connected_(session) == 1);
 }
Exemple #21
0
 public static extern int ssh_get_error_code(SessionHandle session);
Exemple #22
0
 private static unsafe extern int ssh_get_server_publickey(SessionHandle session, IntPtr *pkey);
Exemple #23
0
 public static extern ChannelHandle ssh_channel_new(SessionHandle session);
Exemple #24
0
 public static extern void ssh_set_blocking(SessionHandle session, int blocking);