authenticate (Net::SSH::UserAuth::Methods::KeyboardInteractive)

    # File lib/net/ssh/userauth/methods/keyboard-interactive.rb, line 53
              def authenticate( next_service, username, data={} )
                password = data[:password]

                msg = @buffers.writer
                msg.write_byte USERAUTH_REQUEST
                msg.write_string username
                msg.write_string next_service
                msg.write_string "keyboard-interactive"
                msg.write_string ""
                msg.write_string ""
                @messenger.send_message msg

                loop do
                  message = @messenger.wait_for_message

                  case message.message_type
                    when USERAUTH_SUCCESS
                      return true
                    when USERAUTH_FAILURE
                      return false
                    when USERAUTH_INFO_REQUEST
                      name = message.buffer.read_string
                      instruction = message.buffer.read_string
                      req = InfoRequest.new( name, instruction, password, [] )
                      password = nil # only use the given password once

                      lang_tag = message.buffer.read_string
                      message.buffer.read_long.times do
                        prompt = message.buffer.read_string
                        echo = message.buffer.read_bool
                        req.prompts << Prompt.new( prompt, echo )
                      end

                      responses = @callback.call( req )
                      msg = @buffers.writer
                      msg.write_byte USERAUTH_INFO_RESPONSE
                      msg.write_long responses.length
                      msg.write_string(*responses)
                      @messenger.send_message msg
                    else
                      raise Net::SSH::Exception,
                        "unexpected reply in keyboard interactive: " +
                          message.inspect
                  end
                end
              end