anon.mixminion.message
Class ReplyBlock

java.lang.Object
  extended by anon.mixminion.message.ReplyBlock

public class ReplyBlock
extends java.lang.Object

Author:
Stefan Roenisch Window - Preferences - Java - Code Style - Code Templates

Field Summary
(package private) static int KEY_LEN
           
(package private) static long KEY_LIFETIME
           
private  byte[] m_headerbytes
           
private  byte[] m_longterm_secret
           
private  java.lang.String m_myaddress
           
private  RoutingInformation m_myrouting
           
private  java.util.Vector m_path
           
private  byte[] m_sharedSecret
           
private  long m_timetolive
           
 
Constructor Summary
ReplyBlock(RoutingInformation routingInfo, byte[] header, byte[] sharedsecret, long time)
          Constructor 2 used to instantiate a ReplyBlock Object, used to parse a ReplyBlock out of a message call parseReplyBlock(String) to complete iT!
ReplyBlock(java.lang.String myaddress, java.util.Vector path, byte[] usersecret)
          Constructor 1 used to build a replyblock, which is appended to a message call build() to complete it!
 
Method Summary
 void buildBlock()
          builds the replyHeader
private static int byteToInt(byte[] b, int offset)
          Calculates the int value of a given ByteArray
 byte[] getHeaderBytes()
          Returns the ReplyHeader as Bytes
 byte[] getReplyBlockasBytes()
          Returns the Replyblock as described underwards
 java.lang.String getReplyBlockasString()
           
 RoutingInformation getRouting()
          Returns the RoutingInformation of the First Server in the Path of the ReplyBlock, needed for the Crossover-Point
 byte[] getSharedSecret()
          Returns the End-to End shared Secret
static java.util.Vector parseReplyBlocks(java.lang.String message, byte[] block)
          Parses a given payload for a ReplyBlock and returns it, return null, when no ReplyBlock is detected
static java.lang.String removeRepyBlocks(java.lang.String message)
          Removes a ascii-armored replyblock from a given payload
 boolean timetoliveIsOK()
          tests whether the replyblock is not older then 3 months
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

KEY_LEN

static final int KEY_LEN
See Also:
Constant Field Values

KEY_LIFETIME

static final long KEY_LIFETIME
See Also:
Constant Field Values

m_sharedSecret

private byte[] m_sharedSecret

m_path

private java.util.Vector m_path

m_longterm_secret

private byte[] m_longterm_secret

m_myrouting

private RoutingInformation m_myrouting

m_headerbytes

private byte[] m_headerbytes

m_myaddress

private java.lang.String m_myaddress

m_timetolive

private long m_timetolive
Constructor Detail

ReplyBlock

public ReplyBlock(java.lang.String myaddress,
                  java.util.Vector path,
                  byte[] usersecret)
Constructor 1 used to build a replyblock, which is appended to a message call build() to complete it!

Parameters:
myadress -
path -
usersecret -

ReplyBlock

public ReplyBlock(RoutingInformation routingInfo,
                  byte[] header,
                  byte[] sharedsecret,
                  long time)
Constructor 2 used to instantiate a ReplyBlock Object, used to parse a ReplyBlock out of a message call parseReplyBlock(String) to complete iT!

Parameters:
routingInfo -
header -
sharedsecret -
time -
Method Detail

buildBlock

public void buildBlock()
builds the replyHeader


getHeaderBytes

public byte[] getHeaderBytes()
Returns the ReplyHeader as Bytes

Returns:
the replyHeader

getSharedSecret

public byte[] getSharedSecret()
Returns the End-to End shared Secret

Returns:
sharedSecret End to End

getReplyBlockasBytes

public byte[] getReplyBlockasBytes()
Returns the Replyblock as described underwards

Returns:
ReplyBlock as Bytes

getReplyBlockasString

public java.lang.String getReplyBlockasString()
Returns:
Base64-encoded ReplyBlock with ascii armor

getRouting

public RoutingInformation getRouting()
Returns the RoutingInformation of the First Server in the Path of the ReplyBlock, needed for the Crossover-Point

Returns:

parseReplyBlocks

public static java.util.Vector parseReplyBlocks(java.lang.String message,
                                                byte[] block)
                                         throws java.io.IOException
Parses a given payload for a ReplyBlock and returns it, return null, when no ReplyBlock is detected

Parameters:
message -
block -
Returns:
Throws:
java.io.IOException

removeRepyBlocks

public static java.lang.String removeRepyBlocks(java.lang.String message)
                                         throws java.io.IOException
Removes a ascii-armored replyblock from a given payload

Parameters:
message -
Returns:
message without the replyblock
Throws:
java.io.IOException

timetoliveIsOK

public boolean timetoliveIsOK()
tests whether the replyblock is not older then 3 months

Returns:

byteToInt

private static int byteToInt(byte[] b,
                             int offset)
Calculates the int value of a given ByteArray

Parameters:
b -
offset -
Returns:
int value of the bytearray