|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.monica.javacom.ciphering.MJCBasicCiphering
This is a middle level layer in the MJC layer hierarchy responsible for ciphering the data stream between the upper layers. Implements cipher key exchanges, coding and encoding. At initialization it is transparent, it leaves data as it is, it just lets input through. After getting setTransparent(false) the keyexchange starts. The client side has the setTransparent(false) called by the upper layer. It sends a special message to the server, that also calls its own setTransparent(false). The server generates an rsa-key-pair, sends the public key to the client in a special packet. After that, he constructs his own RSA coder with the private key of the keypair just generated. The client, after receiving the public key, constructs his RSA coder, and generates an aes key. He sends this key, coded with the public key, to the server, and constructs his AES coder. The server, as he got the AES key, also constructs the AES coder. So, by now, both sides have the proper AES coder (hopefully). The server sends a special String, included in a control pocket, to the client, and switches to ciphering mode. From this point he can only recieve encripted data, this means, every pocket, he gets will be decripted before forwarding it to the upper layer. The client, as it gets the special control packet, tries to decript it. If the original String is the result, then everything worked fine during the key exchange, and it also switches to ciphering mode, like the server. At this point the setTransparent(false) function returns from its synchronized state, and the communication (telnet initialization, authentification, data exchange) can go on encripted.
Constructor Summary | |
MJCBasicCiphering(boolean in_enVagyokASzerver)
Constructs a new MJCCiphering layer. |
Method Summary | |
void |
connectionClosedEvent(MJCReadable readable)
Indicates that the source connection of the specified MJCReadable has been closed. |
void |
errorEvent(java.lang.String errorDescription,
MJCReadable readable)
Indicates that there was an error in the source connection of the specified MJCReadable. |
void |
flush()
Flushes the contents of the write buffer to bottom layers. |
int |
getAvailable()
Returns the number of bytes that are available for read out from this MJCReadable. |
java.lang.String |
getCipheringName()
Returns the MJC name of the MJCCiphering. |
java.lang.String |
getCipheringVersion()
Returns the MJC version of the MJCCiphering. |
MJCConfiguration |
getConfiguration()
Returns the MJCConfiguration with which this object is customized. |
java.lang.String |
getInput()
Returns the contents of the read buffer from this MJCReadable. |
java.lang.String |
getLastWriteableError()
Returns the error message of the last occured error. |
MJCReadable |
getReadable()
Returns the MJCReadable from which data will be read. |
java.lang.String |
getReadableName()
Returns the MJC name of the MJCReadable. |
java.lang.String |
getReadableVersion()
Returns the MJC version of the MJCReadable. |
MJCReader |
getReader()
Returns the MJCReader to which readEvents will be sent. |
java.lang.String |
getReaderName()
Returns the MJC name of the MJCReader. |
java.lang.String |
getReaderVersion()
Returns the MJC version of the MJCReader. |
MJCWriteable |
getWriteable()
Returns the MJCWriteable to which this MCJWriter will write. |
java.lang.String |
getWriteableName()
Returns the MJC name of the MJCWriteable. |
java.lang.String |
getWriteableVersion()
Returns the MJC version of the MJCWriteable. |
java.lang.String |
getWriterName()
Returns the MJC name of the MJCWriter. |
java.lang.String |
getWriterVersion()
Returns the MJC version of the MJCWriter. |
boolean |
isReadableConnected()
Returns wether the MJCReadable is still connected to its source. |
boolean |
isWriteableConnected()
Returns wether the MJCWriteable is connected to its target. |
void |
readEvent(MJCReadable readable)
Indicates that there is data available from the specified MJCReadable. |
void |
run()
Run thread. |
void |
setConfiguration(MJCConfiguration configuration)
Sets the MJCConfiguration for this object. |
void |
setReadable(MJCReadable readable)
Sets the MJCReadable from which data has to be read. |
void |
setReader(MJCReader reader)
Sets the MJCReader to which the readEvents have to be sent. |
void |
setTransparent(boolean status)
This method toggles the transparency mode of the MJCCiphering layer. |
void |
setWriteable(MJCWriteable writeable)
Sets the MJCWriteable to which this MJCWriter will write. |
boolean |
write(char c)
Writes one single char. |
boolean |
write(char[] c)
Writes a char array. |
boolean |
write(java.lang.String s)
Writes a String. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public MJCBasicCiphering(boolean in_enVagyokASzerver)
in_enVagyokASzerver
- true if this is the server side, false if this is the client sideMethod Detail |
public java.lang.String getCipheringName()
getCipheringName
in interface MJCCiphering
public java.lang.String getCipheringVersion()
getCipheringVersion
in interface MJCCiphering
public void setTransparent(boolean status)
setTransparent
in interface MJCCiphering
status
- the desired transparency modepublic java.lang.String getWriterName()
getWriterName
in interface MJCWriter
public java.lang.String getWriterVersion()
getWriterVersion
in interface MJCWriter
public void setWriteable(MJCWriteable writeable)
setWriteable
in interface MJCWriter
writeable
- the MJCWriteable to which this MJCWriter will writepublic MJCWriteable getWriteable()
getWriteable
in interface MJCWriter
public void setConfiguration(MJCConfiguration configuration)
setConfiguration
in interface MJCConfigureable
configuration
- the MJCConfiguration object for the customizationpublic MJCConfiguration getConfiguration()
getConfiguration
in interface MJCConfigureable
public java.lang.String getReadableName()
getReadableName
in interface MJCReadable
public java.lang.String getReadableVersion()
getReadableVersion
in interface MJCReadable
public boolean isReadableConnected()
isReadableConnected
in interface MJCReadable
public int getAvailable()
getAvailable
in interface MJCReadable
public java.lang.String getInput()
getInput
in interface MJCReadable
public void setReader(MJCReader reader)
setReader
in interface MJCReadable
reader
- the MJCReader to which the readEvents have to be sentpublic MJCReader getReader()
getReader
in interface MJCReadable
public void setReadable(MJCReadable readable)
setReadable
in interface MJCReader
readable
- the MJCReadable from which data has to be readpublic MJCReadable getReadable()
getReadable
in interface MJCReader
public void run()
run
in interface java.lang.Runnable
public java.lang.String getReaderName()
getReaderName
in interface MJCReader
public java.lang.String getReaderVersion()
getReaderVersion
in interface MJCReader
public void readEvent(MJCReadable readable)
readEvent
in interface MJCReader
readable
- there is data available from the readablepublic void connectionClosedEvent(MJCReadable readable)
connectionClosedEvent
in interface MJCReader
readable
- the MJCReadable whose source connection has been closedpublic void errorEvent(java.lang.String errorDescription, MJCReadable readable)
errorEvent
in interface MJCReader
errorDescription
- the error messagereadable
- the MJCReadable where the error occuredpublic java.lang.String getWriteableName()
getWriteableName
in interface MJCWriteable
public java.lang.String getWriteableVersion()
getWriteableVersion
in interface MJCWriteable
public boolean write(char c)
write
in interface MJCWriteable
c
- the char to be writtenpublic boolean write(char[] c)
write
in interface MJCWriteable
c
- the char array to be writtenpublic boolean write(java.lang.String s)
write
in interface MJCWriteable
s
- the String to be writtenpublic void flush()
flush
in interface MJCWriteable
public java.lang.String getLastWriteableError()
getLastWriteableError
in interface MJCWriteable
public boolean isWriteableConnected()
isWriteableConnected
in interface MJCWriteable
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |