Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

com.ciphercore
Class Server  view Server download Server.java

java.lang.Object
  extended bycom.ciphercore.Server

public class Server
extends java.lang.Object

The CipherCore server. This is the class that responds to client requests. Each request specifies a child type, which the Server checks against it's list of allowed types. If the type is allowed, it spawns the child, gives it a copy of the servers Diffie Hellman key, and returns to waiting for the next child.

Basic Usage


 java com.ciphercore.Server --children=pkg1.Class1:pkg2.Class2
 


Field Summary
private  java.lang.String _advancedCfgLocation
           
private  java.util.HashSet _approvedChildren
           
private  java.lang.String _basicCfgLocation
           
private  com.traxel.crypto.CipherPartner _cipherSelf
           
private  java.util.HashMap _interProcessObjects
           
private  javax.crypto.spec.DHParameterSpec _params
           
private  int _port
           
private  java.lang.String _privKeyLocation
           
private  java.lang.String _pubKeyLocation
           
private  java.lang.String _pubSha1Location
           
private  java.util.Properties _userHashes
           
private  java.lang.String _userHashesLocation
           
static int DEFAULT_PORT
          If no port is specified, run on 5943.
static java.lang.String DEFAULT_PROVIDER_NAME
           
static java.lang.String DEFAULT_PROVIDER_NAME_OLD1
           
static java.lang.String DEFAULT_PROVIDER_NAME_OLD2
           
 
Constructor Summary
Server(java.util.HashSet approvedChildren)
          Create a Server which allows the specified children, on the default port (5943), in the specified mode (Server.SECURE_MODE or Server.INSECURE_MODE).
Server(java.util.HashSet approvedChildren, int port)
          Create a Server which allows the specified children, on the specified port, in the specified mode (Server.SECURE_MODE or Server.INSECURE_MODE).
 
Method Summary
protected  void generateKeys()
           
 java.lang.String getAdvancedCfgLocation()
           
 java.lang.String getBasicCfgLocation()
           
 com.traxel.crypto.CipherPartner getCipherSelf()
           
 InterProcessObject getIPO(java.lang.String childClassName)
           
 javax.crypto.spec.DHParameterSpec getParams()
           
 int getPort()
           
 java.lang.String getPrivKeyLocation()
           
 java.lang.String getProviderName()
           
 java.lang.String getPubKeyLocation()
           
 java.lang.String getPubSha1Location()
           
 java.lang.String getUserHash(java.lang.String userName)
           
 java.util.Properties getUserHashes()
           
 java.lang.String getUserHashesLocation()
           
protected  void handleClient(java.net.Socket socket)
          This method determines the requested client type, and spawns the appropriate child.
private  void initializeSelf()
           
 boolean isApproved(java.lang.String childClassName)
           
protected  Child launchChild(java.lang.String childClassName, java.net.Socket socket)
          Verifies that the specified class is allowed to run in this server, then instantiates the child, gives it a reference to this child type's interprocess object, gives it a copy of the DHPartner, and starts the child.
protected  void locateFiles()
           
static void main(java.lang.String[] args)
           
protected static java.util.HashSet parseApprovedChildren(java.lang.String[] args)
           
protected  void putIPO(java.lang.String childClassName, InterProcessObject ipo)
           
protected  void readAdvancedCfg()
           
protected  void readBasicCfg()
           
protected  void readKeys()
           
protected static java.lang.String readNextString(java.io.DataInputStream in)
          A convenience method that reads the next string.
protected  void readUserHashes()
           
 void run()
          This method accepts the incoming client and hands the socket off to handleClient( socket ).
protected  void setAdvancedCfgLocation(java.lang.String location)
           
protected  void setApprovedChildren(java.util.HashSet approvedChildren)
           
protected  void setBasicCfgLocation(java.lang.String location)
           
protected  void setCipherSelf(com.traxel.crypto.CipherPartner self)
           
protected  void setParams(javax.crypto.spec.DHParameterSpec params)
           
protected  void setPort(int port)
           
protected  void setPrivKeyLocation(java.lang.String location)
           
protected  void setPubKeyLocation(java.lang.String location)
           
protected  void setPubSha1Location(java.lang.String location)
           
protected  void setUserHashes(java.util.Properties userHashes)
           
protected  void setUserHashesLocation(java.lang.String location)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_PORT

public static final int DEFAULT_PORT
If no port is specified, run on 5943.

See Also:
Constant Field Values

DEFAULT_PROVIDER_NAME_OLD1

public static final java.lang.String DEFAULT_PROVIDER_NAME_OLD1
See Also:
Constant Field Values

DEFAULT_PROVIDER_NAME_OLD2

public static final java.lang.String DEFAULT_PROVIDER_NAME_OLD2
See Also:
Constant Field Values

DEFAULT_PROVIDER_NAME

public static final java.lang.String DEFAULT_PROVIDER_NAME
See Also:
Constant Field Values

_port

private int _port

_params

private javax.crypto.spec.DHParameterSpec _params

_cipherSelf

private com.traxel.crypto.CipherPartner _cipherSelf

_interProcessObjects

private java.util.HashMap _interProcessObjects

_approvedChildren

private java.util.HashSet _approvedChildren

_basicCfgLocation

private java.lang.String _basicCfgLocation

_advancedCfgLocation

private java.lang.String _advancedCfgLocation

_pubKeyLocation

private java.lang.String _pubKeyLocation

_pubSha1Location

private java.lang.String _pubSha1Location

_privKeyLocation

private java.lang.String _privKeyLocation

_userHashesLocation

private java.lang.String _userHashesLocation

_userHashes

private java.util.Properties _userHashes
Constructor Detail

Server

public Server(java.util.HashSet approvedChildren)
Create a Server which allows the specified children, on the default port (5943), in the specified mode (Server.SECURE_MODE or Server.INSECURE_MODE).


Server

public Server(java.util.HashSet approvedChildren,
              int port)
Create a Server which allows the specified children, on the specified port, in the specified mode (Server.SECURE_MODE or Server.INSECURE_MODE).

Method Detail

initializeSelf

private void initializeSelf()

run

public void run()
This method accepts the incoming client and hands the socket off to handleClient( socket ). In the future, this is where service independant IP based blocking (IE: across the board denial) should occur.


handleClient

protected void handleClient(java.net.Socket socket)
                     throws java.io.IOException
This method determines the requested client type, and spawns the appropriate child. In the future, this is where service dependant IP based blocking (IE: only specific accounts can spawn childs of type X) should occur.


readNextString

protected static java.lang.String readNextString(java.io.DataInputStream in)
                                          throws java.io.IOException
A convenience method that reads the next string.


launchChild

protected Child launchChild(java.lang.String childClassName,
                            java.net.Socket socket)
                     throws java.lang.ClassNotFoundException,
                            java.lang.InstantiationException,
                            java.lang.IllegalAccessException
Verifies that the specified class is allowed to run in this server, then instantiates the child, gives it a reference to this child type's interprocess object, gives it a copy of the DHPartner, and starts the child.


locateFiles

protected void locateFiles()

readBasicCfg

protected void readBasicCfg()

readAdvancedCfg

protected void readAdvancedCfg()

readUserHashes

protected void readUserHashes()

readKeys

protected void readKeys()

generateKeys

protected void generateKeys()

setPort

protected void setPort(int port)

setParams

protected void setParams(javax.crypto.spec.DHParameterSpec params)

setCipherSelf

protected void setCipherSelf(com.traxel.crypto.CipherPartner self)

putIPO

protected void putIPO(java.lang.String childClassName,
                      InterProcessObject ipo)

setBasicCfgLocation

protected void setBasicCfgLocation(java.lang.String location)

setAdvancedCfgLocation

protected void setAdvancedCfgLocation(java.lang.String location)

setPubKeyLocation

protected void setPubKeyLocation(java.lang.String location)

setPubSha1Location

protected void setPubSha1Location(java.lang.String location)

setPrivKeyLocation

protected void setPrivKeyLocation(java.lang.String location)

setUserHashesLocation

protected void setUserHashesLocation(java.lang.String location)

setUserHashes

protected void setUserHashes(java.util.Properties userHashes)

setApprovedChildren

protected void setApprovedChildren(java.util.HashSet approvedChildren)

getPort

public int getPort()

getParams

public javax.crypto.spec.DHParameterSpec getParams()

getCipherSelf

public com.traxel.crypto.CipherPartner getCipherSelf()

isApproved

public boolean isApproved(java.lang.String childClassName)

getProviderName

public java.lang.String getProviderName()

getBasicCfgLocation

public java.lang.String getBasicCfgLocation()

getAdvancedCfgLocation

public java.lang.String getAdvancedCfgLocation()

getPubKeyLocation

public java.lang.String getPubKeyLocation()

getPubSha1Location

public java.lang.String getPubSha1Location()

getPrivKeyLocation

public java.lang.String getPrivKeyLocation()

getUserHashesLocation

public java.lang.String getUserHashesLocation()

getUserHashes

public java.util.Properties getUserHashes()

getIPO

public InterProcessObject getIPO(java.lang.String childClassName)

getUserHash

public java.lang.String getUserHash(java.lang.String userName)

parseApprovedChildren

protected static java.util.HashSet parseApprovedChildren(java.lang.String[] args)

main

public static void main(java.lang.String[] args)
                 throws java.io.IOException