|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Object | +--core.Message
This class represents a Message
| Field Summary | |
private java.lang.String |
string
This string represents the content of the message |
| Constructor Summary | |
Message()
Creates a new empty message |
|
Message(Agent agent)
Creates a new message containing the given string It is advised to only use Base64 string in the message to avoid any issue |
|
Message(INonce nonce)
|
|
Message(Message m1,
Message m2)
Creates a new message containing the two given Messages contatenated |
|
| Method Summary | |
void |
addMessage(Message msg)
This method concats two messages and put an 'at' symbol between them so that we can divide it later with the method getAllFields for example This means that a Message should never contain the symbol 'at' It is advised to only use Base64 string in the message to avoid any issue |
protected java.lang.Object |
clone()
Creates a copy of the Message |
void |
decrypt(java.lang.String algorithm,
java.security.Key key)
Decrypt the message with a given key, using the given algorithm. |
void |
encrypt(java.lang.String algorithm,
java.security.Key key)
Encrypts the message with the given key, using the given algorithm, and put the result in Base64 format |
boolean |
equals(Message other)
Check if the Message is equal to another one |
IMessage[] |
getAllFields()
Returns an array containing the different parts of a message, ie the different messages that have been concatenated in order to build this message |
private Message |
getField(int field)
Returns a given part of the message This method should not be used directly, cf getAllFields instead |
private int |
getNbFields()
This method tells how many submessages a message contain This method should not be used directly, cf getAllFields |
java.lang.String |
getString()
This method returns the value of the protected member string It is especially useful to send a message to another host |
void |
hash()
This method hashes the Message |
void |
setString(java.lang.String string)
Change the value of the private member string into the given string It is advised to only use Base64 string in the message to avoid any issue |
| Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
private java.lang.String string
| Constructor Detail |
public Message()
public Message(Agent agent)
public Message(INonce nonce)
public Message(Message m1,
Message m2)
m1 - first messagem2 - second message| Method Detail |
public java.lang.String getString()
getString in interface IMessagepublic void setString(java.lang.String string)
setString in interface IMessagestring - new value for the content of the messagepublic void addMessage(Message msg)
addMessage in interface IMessagemsg - private int getNbFields()
private Message getField(int field)
throws java.lang.Exception
field - number of the field to get
java.lang.Exception - if the message does not contain the part that has been asked forpublic IMessage[] getAllFields()
getAllFields in interface IMessage
public void encrypt(java.lang.String algorithm,
java.security.Key key)
throws java.lang.Exception
encrypt in interface IMessagealgorithm - algorithm to use for encryptionkey - key to use for encryption
java.lang.Exception
public void decrypt(java.lang.String algorithm,
java.security.Key key)
throws java.lang.Exception
decrypt in interface IMessagealgorithm - algorithm to use for decryptionkey - key to use for decryption
java.lang.Exception
public void hash()
throws java.security.NoSuchAlgorithmException
hash in interface IMessagejava.security.NoSuchAlgorithmException
protected java.lang.Object clone()
throws java.lang.CloneNotSupportedException
clone in class java.lang.Objectjava.lang.CloneNotSupportedExceptionObject.clone()public boolean equals(Message other)
equals in interface IMessageother - the other Message
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||