Free.util
Class Packet

java.lang.Object
  |
  +--Free.util.Packet

public class Packet
extends java.lang.Object

Packet is the data type that represents all GNU.FREE packets used in its protocols.

Version:
0.8.1 27 October 2001
Author:
Jason Kitcat

Constructor Summary
Packet(char t, java.lang.String m, java.lang.String sk, java.lang.String rk, java.lang.String hk, int sn)
          constructor which creates packet ready for encryption and sending
Packet(java.lang.String p)
          constructor which parses Strings into valid packets
 
Method Summary
 java.lang.String getDigest()
          return message digest of Packet
 java.lang.String getMACMessage()
          return the portion of Packet used in MAC
 java.lang.String getMessage()
          return the data portion of Packet
 char getType()
          return type of Packet
 java.lang.String[] splitMessage()
          splits message into constituent parts as identified by '-' Maximum sub-parts of a message is 20
 java.lang.String toCryptString(boolean mode)
          returns encrypted value of Packet ready for sending.
 java.lang.String toString()
          returns a printable value of Packet.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Packet

public Packet(java.lang.String p)
constructor which parses Strings into valid packets
Parameters:
p - A String containing the data to parse

Packet

public Packet(char t,
              java.lang.String m,
              java.lang.String sk,
              java.lang.String rk,
              java.lang.String hk,
              int sn)
       throws java.lang.Exception
constructor which creates packet ready for encryption and sending
Parameters:
t - The packet's type.
m - The packet's message.
sk - The session key for encryption.
rk - The RSA key for encrypting the session key.
hk - The HMAC key for creating the MAC.
sn - The sequence number for the HMAC creation.
Method Detail

toString

public java.lang.String toString()
returns a printable value of Packet.
Overrides:
toString in class java.lang.Object

toCryptString

public java.lang.String toCryptString(boolean mode)
                               throws java.lang.Exception
returns encrypted value of Packet ready for sending.
Parameters:
mode - True if a client, false if a server.

splitMessage

public java.lang.String[] splitMessage()
splits message into constituent parts as identified by '-' Maximum sub-parts of a message is 20

getMessage

public java.lang.String getMessage()
return the data portion of Packet

getMACMessage

public java.lang.String getMACMessage()
return the portion of Packet used in MAC

getDigest

public java.lang.String getDigest()
return message digest of Packet

getType

public char getType()
return type of Packet