issrg.SAWS
Class SAWSServer

java.lang.Object
  extended by issrg.SAWS.SAWSServer

public class SAWSServer
extends java.lang.Object

This is the SAWS Server class. It provides all the necessary API methods for SAWS API clients.

Author:
W. Xu

Nested Class Summary
 class SAWSServer.HeartbeatRecordWriting
          This sub class is for generating heartbeat records.
 
Field Summary
 int currentReadingFileNo
           
 java.util.Vector logFileList
           
 java.util.Vector recordBlockListFromOneLogFile
           
 
Constructor Summary
SAWSServer()
          This method is the constructor of SAWSServer.
SAWSServer(int flag)
          This method is the constructor of SAWSServer.
 
Method Summary
 void closeLog()
          This method closes the current log file.
 void createEncryptionKeystore()
          This method is used by the SAWS command line mode to create the encryption keystore
 void createSigningKeystore()
          This method is used by the SAWS command line mode to create the signing keystore
 void exportSigningPKC()
          This method is used by the SAWS command line mode to output the PKC in the signing keystore.
 void importRootCA()
          This method is used by the SAWS command line mode to import the root CA PKC into the signing keystore
 void importSigningPKC()
          This method is used by the SAWS command line mode to import the signing PKC which is issued by root CA into the signing keystore
 void listSigningKeystore()
          This method is used by the SAWS command line mode to list all entries in the signing keystore
static void main(java.lang.String[] args)
          This main method is SAWS command-line working mode.
 void outputPKCRequest()
          This method is used by the SAWS command line mode to output the PKC request file from the signing keystore.
 java.util.Vector sawsReadOneLogFile()
          This method is to read saws log files one at a time from the first log file to the last log file in the log file list logFileList.
 void sawsStart()
          This method is to start SAWSServer to record client records.
 RecordStatus sendLogRecord(byte[] messageBlock)
          This method is used by the SAWS API client to send a log message to SAWS server.
 RecordStatus sendLogRecord(byte[] messageBlock, byte encryptionFlag)
          This method is used by the SAWS API client to send a log message to SAWS server.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logFileList

public java.util.Vector logFileList

currentReadingFileNo

public int currentReadingFileNo

recordBlockListFromOneLogFile

public java.util.Vector recordBlockListFromOneLogFile
Constructor Detail

SAWSServer

public SAWSServer()
This method is the constructor of SAWSServer. It is for SAWS web service interface. It is equivalent to the following constructor when flag = 1 (see SAWSServer(int flag))


SAWSServer

public SAWSServer(int flag)
This method is the constructor of SAWSServer. It accepts flag values 0 or 1. The flag=0 is for SAWS command line mode. The initialization process for logging client records is run when flag=1. It consists of reading the TCB(Trusted Computing Base) content to get the last log file name, accumulated hash and last record sequence number. It also creates a new log file to start logging and adds the information to the TCB location (e.g. name, random number). The initialization process includes verification of the last log file, creating a list of the log files in the log repository and verifying the log file chain if the administrator decides to.The chain can be constructured since each log file contains a record indicating the previous log file name. The first log file name contains a record indicating that "this is the first log file"

Parameters:
int - flag =0: for SAWS command line mode initialisation; flag=1: on top of flag=0, initializes SAWSServer for preparing to record client records.
Method Detail

sawsStart

public void sawsStart()
This method is to start SAWSServer to record client records.


sawsReadOneLogFile

public java.util.Vector sawsReadOneLogFile()
This method is to read saws log files one at a time from the first log file to the last log file in the log file list logFileList. So you can invoke it again and again unitl null is returned.

Returns:
Vector the Vector of log records

closeLog

public void closeLog()
This method closes the current log file.


sendLogRecord

public RecordStatus sendLogRecord(byte[] messageBlock)
This method is used by the SAWS API client to send a log message to SAWS server. No encryption is used by this method.

Parameters:
messageBlock - is the log message to be sent.
Returns:
The status of the record (RecordStatus).

sendLogRecord

public RecordStatus sendLogRecord(byte[] messageBlock,
                                  byte encryptionFlag)
This method is used by the SAWS API client to send a log message to SAWS server. Since this log message is coming from a SAWS client, so the log message type is certainly SAWSClientLogDataType.

Parameters:
messageBlock - is the log message to be sent.
encryptionFlag - encryption flag to indicate the encryption requirement. SAWSConstant.NoEncryptionFlag: log with no encryption; SAWSConstant.SymmetricEncryptionFlag: log with symmetric encryption; SAWSConstant.CommandFlag: command for SAWS to perform: the command contents are contained in messageBlock.
Returns:
The status of the record (RecordStatus).

outputPKCRequest

public void outputPKCRequest()
This method is used by the SAWS command line mode to output the PKC request file from the signing keystore.


exportSigningPKC

public void exportSigningPKC()
This method is used by the SAWS command line mode to output the PKC in the signing keystore.


createEncryptionKeystore

public void createEncryptionKeystore()
This method is used by the SAWS command line mode to create the encryption keystore


createSigningKeystore

public void createSigningKeystore()
This method is used by the SAWS command line mode to create the signing keystore


importRootCA

public void importRootCA()
This method is used by the SAWS command line mode to import the root CA PKC into the signing keystore


importSigningPKC

public void importSigningPKC()
This method is used by the SAWS command line mode to import the signing PKC which is issued by root CA into the signing keystore


listSigningKeystore

public void listSigningKeystore()
This method is used by the SAWS command line mode to list all entries in the signing keystore


main

public static void main(java.lang.String[] args)
                 throws java.lang.Exception
This main method is SAWS command-line working mode.

Throws:
java.lang.Exception