|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object issrg.SAWS.LogFileWriter
public class LogFileWriter
Field Summary | |
---|---|
byte[] |
accumulatedHash
|
int |
currentRecordWriteCount
|
byte[] |
finalSignature
|
Constructor Summary | |
---|---|
LogFileWriter()
This method is the constructor of LogFileWriter. |
|
LogFileWriter(java.lang.String root,
java.lang.String cLogFilename,
java.security.PublicKey vt,
java.security.PublicKey sawsEncPK,
java.security.PrivateKey sawsSignPIK,
byte[] ba,
java.lang.String hashAlgorithm,
byte[] secureBytes,
java.util.Map UserIDPKMap,
java.lang.String signingAlgorithm)
This method is the constructor of LogFileWriter. |
|
LogFileWriter(java.lang.String root,
java.lang.String cLogFilename,
java.security.PublicKey vt,
java.security.PublicKey sawsEncPK,
java.security.PrivateKey sawsSignPIK,
byte[] ba,
java.lang.String hashAlgorithm,
byte[] secureBytes,
java.util.Map UserIDPKMap,
java.lang.String signingAlgorithm,
javax.security.auth.callback.CallbackHandler ch)
This method is the constructor of LogFileWriter. |
Method Summary | |
---|---|
void |
createLastFileRecord(java.lang.String lastFilename,
byte[] lastAccHash,
byte[] lastSignature)
This method is to generate the record body of a last log file record. |
void |
createSAWSRecord(byte[] messageBlock,
byte recordType,
byte encryptionFlag)
This method is to create a SAWS Record . |
void |
createSAWSRecord(byte[] messageBlock,
byte recordType,
byte userID,
byte encryptionFlag)
This method is to create a SAWS Record . |
void |
createSAWSRecord(byte[] messageBlock,
byte recordType,
byte userID,
byte encryptionFlag,
java.security.PublicKey encryptionPublicKey)
This method is to create a SAWS Record . |
void |
finalizeLogFile()
This method is called to finalize the log file, i.e. |
byte[] |
getAccHash()
This method is to get the final accumualted hash. |
int |
getCurrentRecordWriteCount()
This method is to get the current writing record number in the current log file. |
java.lang.String |
getHashAlgorithm()
This method returns the disgest algorithm name. |
byte[] |
getSignature()
This method is to get the final signature. |
int |
prepareNewLog()
This method creates a new log file, prepares this file for adding new log records to it in the future. |
int |
repairLog(java.lang.String logRoot,
java.lang.String logFilename,
byte[] secureRandomB,
logReadingException e)
This method is to repair a log file. |
void |
setCallbackHandler(javax.security.auth.callback.CallbackHandler ch)
Method that sets the callback handler for the class. |
void |
setDebugLevel(int debugLevel)
Method that sets the debug level. |
void |
setHashAlgorithm(java.lang.String hashAlgorithm)
This method is to set the hashing algorithm name. |
void |
writeSignatureRecord(byte signatureType)
This method is called to write a signature record to the log file after initialisation is finished. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public int currentRecordWriteCount
public byte[] accumulatedHash
public byte[] finalSignature
Constructor Detail |
---|
public LogFileWriter()
public LogFileWriter(java.lang.String root, java.lang.String cLogFilename, java.security.PublicKey vt, java.security.PublicKey sawsEncPK, java.security.PrivateKey sawsSignPIK, byte[] ba, java.lang.String hashAlgorithm, byte[] secureBytes, java.util.Map UserIDPKMap, java.lang.String signingAlgorithm)
root
- The log root, the place where the log files are stored.cLogFilename
- The log file name to be written.vt
- The SAWS VT public key.sawsEncPK
- The SAWS encryption public key.sawsSignPIK
- The SAWS signing private key.ba
- The binary array of the SAWS signing public key certificate to be written into
the log file.hashAlgorithm
- The hash algorithm name, e.g. MD5.secureBytes
- The secure random number used for secure hashing.UserIDPKMap
- A map with the user's IDs and the respective public key.signingAlgorithm
- The signing algorithm name, e.g. MD5withRSA.public LogFileWriter(java.lang.String root, java.lang.String cLogFilename, java.security.PublicKey vt, java.security.PublicKey sawsEncPK, java.security.PrivateKey sawsSignPIK, byte[] ba, java.lang.String hashAlgorithm, byte[] secureBytes, java.util.Map UserIDPKMap, java.lang.String signingAlgorithm, javax.security.auth.callback.CallbackHandler ch)
root
- The log root, the place where the log files are stored.cLogFilename
- The log file name to be written.vt
- The SAWS VT public key.sawsEncPK
- The SAWS encryption public key.sawsSignPIK
- The SAWS signing private key.ba
- The binary array of the SAWS signing public key certificate to be written into
the log file.hashAlgorithm
- The hash algorithm name, e.g. MD5.secureBytes
- The secure random number used for secure hashing.UserIDPKMap
- A map with the user's IDs and the respective public key.signingAlgorithm
- The signing algorithm name, e.g. MD5withRSA.ch
- The callback hadler.Method Detail |
---|
public void setDebugLevel(int debugLevel)
debugLevel
- indicates the different level of debug output information by SAWS.
Its value is from 0 to 5. When its value is 0, then no debug information is output by SAWS.
When its value is 5, then most debug information is output by SAWS.public void setCallbackHandler(javax.security.auth.callback.CallbackHandler ch)
ch
- The callback handler.public void setHashAlgorithm(java.lang.String hashAlgorithm)
hashAlgorithm
- The hash algorithm name. Please consult the user guide for the supported algorithms.public java.lang.String getHashAlgorithm()
public byte[] getSignature()
public byte[] getAccHash()
public int getCurrentRecordWriteCount()
public int prepareNewLog()
public void createLastFileRecord(java.lang.String lastFilename, byte[] lastAccHash, byte[] lastSignature)
lastFilename
- the file name of the previous log filelastAccHash
- the accumulated hash of the previous log filelastSignature
- the signature of the previous log filepublic void createSAWSRecord(byte[] messageBlock, byte recordType, byte encryptionFlag)
messageBlock
- log data block (here it is the secret random number to be wrapped into a record.recordType
- record typeencryptionFlag
- encryption flag to indicate the encryption requirement.public void createSAWSRecord(byte[] messageBlock, byte recordType, byte userID, byte encryptionFlag)
messageBlock
- log data block (here it is the secret random number to be wrapped into a record.recordType
- record typeuserID
- user IDencryptionFlag
- encryption flag to indicate the encryption requirement.public void createSAWSRecord(byte[] messageBlock, byte recordType, byte userID, byte encryptionFlag, java.security.PublicKey encryptionPublicKey)
messageBlock
- log data block (here it is the secret random number to be wrapped into a record.recordType
- record typeuserID
- user IDencryptionFlag
- encryption flag to indicate the encryption requirement.encryptionPublicKey
- the encryption public key used for assymmetric encryption.
This could be the VT enc public key, or the SAWS enc public keypublic int repairLog(java.lang.String logRoot, java.lang.String logFilename, byte[] secureRandomB, logReadingException e)
logRoot
- the log rootlogFilename
- the log filename to be repaired.secureRandomB
- byte[] is the secure random bytes for this log filelogReadingException
- e is the exception class containing all the necessary information for the repair.
public void finalizeLogFile()
public void writeSignatureRecord(byte signatureType)
signatureType
- The type of signature record: SAWSConstant.SAWSHeaderSignatureType for the
signature of the log file header; or SAWSConstant.SAWSSigningAlgorithmType for the signature
of the complete log file.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |