com.mindbright.ssh
Class SSHServer

java.lang.Object
  extended bycom.mindbright.ssh.SSH
      extended bycom.mindbright.ssh.SSHServer
All Implemented Interfaces:
java.lang.Runnable

public class SSHServer
extends SSH
implements java.lang.Runnable

Version:
0.96, 12/04/98
Author:
Mats Andersson
See Also:
SSHClient

Field Summary
protected  int cliVersionMajor
           
protected  int cliVersionMinor
           
protected  java.lang.String cliVersionStr
           
protected  SSHChannelController controller
           
protected  java.net.InetAddress localAddr
           
protected  java.lang.Thread myThread
           
protected  SecureRandomAndPad rand
           
protected  java.io.BufferedInputStream sshIn
           
protected  java.io.BufferedOutputStream sshOut
           
protected  java.net.Socket sshSocket
           
 
Fields inherited from class com.mindbright.ssh.SSH
AUTH_CRYPTOCARD, AUTH_DEFAULT, AUTH_KBDINTERACT, AUTH_KERBEROS, AUTH_NOTSUPPORTED, AUTH_PASSWORD, AUTH_PUBLICKEY, AUTH_RHOSTS, AUTH_RHOSTS_RSA, AUTH_SDI, AUTH_TIS, authTypeDesc, CIPHER_3DES, CIPHER_BLOWFISH, CIPHER_DEFAULT, CIPHER_DES, CIPHER_IDEA, CIPHER_NONE, CIPHER_NOTSUPPORTED, CIPHER_RC4, CIPHER_RESERVED, CIPHER_TSS, cipherClasses, cipherType, CMSG_ACM_ACCESS_DENIED, CMSG_ACM_NEW_PIN, CMSG_ACM_NEW_PIN_ACCEPTED, CMSG_ACM_NEW_PIN_REJECTED, CMSG_ACM_NEW_PIN_REQUIRED, CMSG_ACM_NEXT_CODE, CMSG_ACM_NEXT_CODE_REQUIRED, CMSG_ACM_OK, CMSG_AGENT_REQUEST_FORWARDING, CMSG_AUTH_PASSWORD, CMSG_AUTH_RHOSTS, CMSG_AUTH_RHOSTS_RSA, CMSG_AUTH_RSA, CMSG_AUTH_RSA_RESPONSE, CMSG_AUTH_SDI, CMSG_AUTH_TIS, CMSG_AUTH_TIS_RESPONSE, CMSG_EOF, CMSG_EXEC_CMD, CMSG_EXEC_SHELL, CMSG_EXIT_CONFIRMATION, CMSG_MAX_PACKET_SIZE, CMSG_PORT_FORWARD_REQUEST, CMSG_REQUEST_COMPRESSION, CMSG_REQUEST_PTY, CMSG_SESSION_KEY, CMSG_STDIN_DATA, CMSG_USER, CMSG_WINDOW_SIZE, CMSG_X11_REQUEST_FORWARDING, CONNECT_CHAN_NUM, CVS_DATE, CVS_NAME, DEBUG, DEBUGMORE, DEFAULTPORT, HOST_KEY_LENGTH, IDX_CIPHER_CLASS, IDX_CIPHER_NAME, isAnSSHClient, KNOWN_HOSTS_FILE, LISTEN_CHAN_NUM, MAIN_CHAN_NUM, MSG_ANY, MSG_CHANNEL_CLOSE, MSG_CHANNEL_CLOSE_CONFIRMATION, MSG_CHANNEL_DATA, MSG_CHANNEL_INPUT_EOF, MSG_CHANNEL_OPEN_CONFIRMATION, MSG_CHANNEL_OPEN_FAILURE, MSG_CHANNEL_OUTPUT_CLOSED, MSG_DEBUG, MSG_DISCONNECT, MSG_IGNORE, MSG_NONE, MSG_PORT_OPEN, PASS_KERBEROS_TGT, protocolFlags, PROTOFLAG_HOST_IN_FWD_OPEN, PROTOFLAG_SCREEN_NUMBER, PROXY_HTTP, PROXY_NONE, PROXY_NOTSUPPORTED, PROXY_SOCKS4, PROXY_SOCKS5_DNS, PROXY_SOCKS5_IP, randomSeed, rcvCipher, rcvComp, secureRandom, SERVER_KEY_LENGTH, SESSION_KEY_LENGTH, sessionId, sessionKey, SMSG_AGENT_OPEN, SMSG_AUTH_RSA_CHALLENGE, SMSG_AUTH_TIS_CHALLENGE, SMSG_EXITSTATUS, SMSG_FAILURE, SMSG_PUBLIC_KEY, SMSG_STDERR_DATA, SMSG_STDOUT_DATA, SMSG_SUCCESS, SMSG_X11_OPEN, sndCipher, sndComp, SRV_HOSTKEY_CHANGED, SRV_HOSTKEY_KNOWN, SRV_HOSTKEY_NEW, srvCookie, srvHostKey, srvServerKey, SSH_VER_MAJOR, SSH_VER_MINOR, supportedAuthTypes, supportedCiphers, TTY_OP_END, TTY_OP_ISPEED, TTY_OP_OSPEED, UNKNOWN_CHAN_NUM, VER_MINDTERM, VER_MINDTUNL
 
Constructor Summary
SSHServer(java.net.Socket sshSocket, int protocolFlags, int supportedCiphers, int supportedAuthTypes, KeyPair srvServerKey, KeyPair srvHostKey)
           
 
Method Summary
static KeyPair generateKeyPair(java.lang.String alg, int bits)
           
 java.net.InetAddress getLocalAddr()
           
 void run()
           
static void setAuthKeysDir(java.lang.String dirName)
           
static void setHostKeyFile(java.lang.String fileName)
           
 void setLocalAddr(java.lang.String addr)
           
static void setServerKeyBits(int bits)
           
static void sshd(int port)
           
protected  void start()
           
 
Methods inherited from class com.mindbright.ssh.SSH
generateKeyFiles, getAltAuthName, getAuthName, getAuthType, getAuthTypes, getCipherName, getCipherType, getProxyType, getProxyTypes, getVersionId, haveSecureRandom, initCipher, initClientCipher, initSeedGenerator, initServerCipher, isAuthTypeSupported, isCipherSupported, isProtocolFlagSet, log, logDebug, logExtra, logIgnore, randomSeed, secureRandom
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

localAddr

protected java.net.InetAddress localAddr

cliVersionStr

protected java.lang.String cliVersionStr

cliVersionMajor

protected int cliVersionMajor

cliVersionMinor

protected int cliVersionMinor

myThread

protected java.lang.Thread myThread

rand

protected SecureRandomAndPad rand

sshSocket

protected java.net.Socket sshSocket

sshIn

protected java.io.BufferedInputStream sshIn

sshOut

protected java.io.BufferedOutputStream sshOut

controller

protected SSHChannelController controller
Constructor Detail

SSHServer

public SSHServer(java.net.Socket sshSocket,
                 int protocolFlags,
                 int supportedCiphers,
                 int supportedAuthTypes,
                 KeyPair srvServerKey,
                 KeyPair srvHostKey)
          throws java.io.IOException
Method Detail

setHostKeyFile

public static void setHostKeyFile(java.lang.String fileName)

setAuthKeysDir

public static void setAuthKeysDir(java.lang.String dirName)

setServerKeyBits

public static void setServerKeyBits(int bits)

getLocalAddr

public java.net.InetAddress getLocalAddr()

setLocalAddr

public void setLocalAddr(java.lang.String addr)
                  throws java.net.UnknownHostException
Throws:
java.net.UnknownHostException

start

protected void start()

run

public void run()
Specified by:
run in interface java.lang.Runnable

sshd

public static void sshd(int port)
                 throws java.io.IOException
Throws:
java.io.IOException

generateKeyPair

public static KeyPair generateKeyPair(java.lang.String alg,
                                      int bits)
                               throws NoSuchAlgorithmException
Throws:
NoSuchAlgorithmException