java.lang.Object
com.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
|
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). |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
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
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).
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