anon.mixminion.message
Class Header

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

public class Header
extends java.lang.Object

Author:
Stefan Roenisch

Field Summary
private  int HASH_LEN
           
private  int HEADER_LEN
           
private  byte[] m_header
           
private  int MIN_SH
           
private  int PK_ENC_LEN
           
private  int PK_MAX_DATA_LEN
           
private  int PK_OVERHEAD_LEN
           
private  byte[] VERSION_MAJOR
           
 
Constructor Summary
Header(java.util.Vector path, java.util.Vector secrets, ExitInformation exitInfo)
          CONSTRUCTOR
 
Method Summary
private  byte[] buildHeader(java.util.Vector path, java.util.Vector secrets, ExitInformation exitInfo)
          builds a header with the specified hops
 byte[] getAsByteArray()
          Gives back the header as byteArray
private  byte[] makeFSHS(byte[] v, byte[] sk, byte[] d, byte[] rs, short rt)
          fixed-size part of the subheader structure
private  byte[] makeSHS(byte[] V, byte[] SK, byte[] D, byte[] RS, short RT, byte[] RI)
          entire subheader
private  int max(int first, int second)
          Compares two int values and returns the larger one
private  byte[] pk_encrypt(MyRSAPublicKey key, byte[] m)
          PublicKey Encryption of
private  byte[] subKey(byte[] secretKey, java.lang.String phrase)
          Subkey
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

HEADER_LEN

private final int HEADER_LEN
See Also:
Constant Field Values

PK_ENC_LEN

private final int PK_ENC_LEN
See Also:
Constant Field Values

PK_OVERHEAD_LEN

private final int PK_OVERHEAD_LEN
See Also:
Constant Field Values

PK_MAX_DATA_LEN

private final int PK_MAX_DATA_LEN
See Also:
Constant Field Values

HASH_LEN

private final int HASH_LEN
See Also:
Constant Field Values

MIN_SH

private final int MIN_SH
See Also:
Constant Field Values

VERSION_MAJOR

private byte[] VERSION_MAJOR

m_header

private byte[] m_header
Constructor Detail

Header

public Header(java.util.Vector path,
              java.util.Vector secrets,
              ExitInformation exitInfo)
CONSTRUCTOR

Parameters:
hops -
recipient -
Method Detail

buildHeader

private byte[] buildHeader(java.util.Vector path,
                           java.util.Vector secrets,
                           ExitInformation exitInfo)
builds a header with the specified hops

Parameters:
hops - int
recipient - String
Returns:
Vector with byte[]-Objects

getAsByteArray

public byte[] getAsByteArray()
Gives back the header as byteArray

Returns:
header byte[]

subKey

private byte[] subKey(byte[] secretKey,
                      java.lang.String phrase)
Subkey

Parameters:
Secret - Key byte[]
phrase - String
Returns:
the subkey byte[]

makeFSHS

private byte[] makeFSHS(byte[] v,
                        byte[] sk,
                        byte[] d,
                        byte[] rs,
                        short rt)
fixed-size part of the subheader structure

Parameters:
version - byte[]
secretkey - byte[]
digest - byte[]
routingsize - byte[]
routingtype - byte[]
Returns:
part byte[]

makeSHS

private byte[] makeSHS(byte[] V,
                       byte[] SK,
                       byte[] D,
                       byte[] RS,
                       short RT,
                       byte[] RI)
entire subheader

Parameters:
Version - byte[]
SecretKey - byte[]
Digest - byte[]
RoutingSize - byte[]
RoutingType - byte[]
RoutingInformation - byte[]
Returns:
entire subheader byte[]

max

private int max(int first,
                int second)
Compares two int values and returns the larger one

Parameters:
first - int
second - int
Returns:
the larger one int

pk_encrypt

private byte[] pk_encrypt(MyRSAPublicKey key,
                          byte[] m)
PublicKey Encryption of

Parameters:
key - MyRSAPublicKey
m - byte[]
Returns:
the digest byte[]