Visual Basic 6.0
Visual Basic 6.0
Start SSH Tunnel Keyboard-Interactive Authentication
See more SSH Tunnel Examples
Demonstrates the Chilkat SshTunnel.StartKeyboardAuth method, which begins keyboard-interactive authentication. The only argument is the login name. It returns XML describing the server's prompts, which are answered with ContinueKeyboardAuth.
Background: Keyboard-interactive is the prompt-driven authentication method: the server sends one or more questions — a password, a one-time code, a security question — and the client answers each. This is how a tunnel supports two-factor and other challenge-response schemes. The returned XML says exactly what to ask and whether to mask the input.
Chilkat Visual Basic 6.0 Downloads
Dim success As Long
success = 0
' Demonstrates the SshTunnel.StartKeyboardAuth method, which begins keyboard-interactive
' authentication. The only argument is the login name. It returns XML describing the server's
' prompts, which are answered with ContinueKeyboardAuth.
Dim tunnel As New ChilkatSshTunnel
' The tunnel forwards accepted local connections to this destination through the SSH server.
tunnel.DestHostname = "db.internal.example.com"
tunnel.DestPort = 5432
' Connect to the SSH server. This performs the TCP/proxy connection and SSH handshake, but
' does not authenticate yet.
Dim sshPort As Long
sshPort = 22
success = tunnel.Connect("ssh.example.com",sshPort)
If (success = 0) Then
Debug.Print tunnel.LastErrorText
Exit Sub
End If
' Begin keyboard-interactive authentication. The returned XML describes the server's prompts.
Dim infoRequestXml As String
infoRequestXml = tunnel.StartKeyboardAuth("mySshLogin")
If (tunnel.LastMethodSuccess = 0) Then
Debug.Print tunnel.LastErrorText
Exit Sub
End If
Debug.Print infoRequestXml
' Answer the prompt(s) with ContinueKeyboardAuth, then call BeginAccepting.
Dim waitForThreadExit As Long
waitForThreadExit = 1
success = tunnel.CloseTunnel(waitForThreadExit)
If (success = 0) Then
Debug.Print tunnel.LastErrorText
Exit Sub
End If