core
Class MessageT

java.lang.Object
  |
  +--core.Message
        |
        +--core.MessageT
All Implemented Interfaces:
IMessage
Direct Known Subclasses:
MessageKeyT, NonceT

public class MessageT
extends Message

This method represents a Message which is tagged

Author:
Xavier Didelot

Field Summary
 
Fields inherited from class core.Message
 
Constructor Summary
MessageT()
           
MessageT(Agent agent)
           
MessageT(INonce nonce)
           
MessageT(Message m1, Message m2)
           
 
Method Summary
 void decrypt(java.lang.String algo, java.security.Key key)
          Decrypt the message with a given key, using the given algorithm.
 void encrypt(java.lang.String algo, java.security.Key key)
          Encrypts the message with the given key, using the given algorithm, and put the result in Base64 format
 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  java.lang.String getOneTag()
           
 Tag getTag()
           
static Tag getTag(Message m)
          Returns the tag of this Message
 java.lang.String getText()
           
 void hash()
          This method hashes the Message
 void removeTags()
           
 void setString(java.lang.String str)
          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 core.Message
addMessage, clone, equals, getString
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MessageT

public MessageT()

MessageT

public MessageT(Agent agent)

MessageT

public MessageT(INonce nonce)

MessageT

public MessageT(Message m1,
                Message m2)
Method Detail

getTag

public static Tag getTag(Message m)
                  throws java.lang.Exception
Returns the tag of this Message

Returns:
the tag of this Message
Throws:
java.lang.Exception - if the message does not contain a valid tag

getTag

public Tag getTag()
           throws java.lang.Exception
java.lang.Exception

getOneTag

private java.lang.String getOneTag()
                            throws java.lang.Exception
java.lang.Exception

getText

public java.lang.String getText()
                         throws java.lang.Exception
java.lang.Exception

decrypt

public void decrypt(java.lang.String algo,
                    java.security.Key key)
             throws java.lang.Exception
Description copied from class: Message
Decrypt the message with a given key, using the given algorithm. The message has to be in Base64 format.

Specified by:
decrypt in interface IMessage
Overrides:
decrypt in class Message
Parameters:
algo - algorithm to use for decryption
key - key to use for decryption
Throws:
java.lang.Exception

encrypt

public void encrypt(java.lang.String algo,
                    java.security.Key key)
             throws java.lang.Exception
Description copied from class: Message
Encrypts the message with the given key, using the given algorithm, and put the result in Base64 format

Specified by:
encrypt in interface IMessage
Overrides:
encrypt in class Message
Parameters:
algo - algorithm to use for encryption
key - key to use for encryption
Throws:
java.lang.Exception

hash

public void hash()
          throws java.security.NoSuchAlgorithmException
Description copied from class: Message
This method hashes the Message

Specified by:
hash in interface IMessage
Overrides:
hash in class Message
Throws:
java.security.NoSuchAlgorithmException

setString

public void setString(java.lang.String str)
Description copied from class: Message
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

Specified by:
setString in interface IMessage
Overrides:
setString in class Message
Parameters:
str - new value for the content of the message

getAllFields

public IMessage[] getAllFields()
Description copied from class: Message
Returns an array containing the different parts of a message, ie the different messages that have been concatenated in order to build this message

Specified by:
getAllFields in interface IMessage
Overrides:
getAllFields in class Message
Returns:
an array containing the different parts of a message

removeTags

public void removeTags()
                throws java.lang.Exception
java.lang.Exception