org.ssonet.mechanisms.accountability
Class AbstractAccountabilityMechanism

java.lang.Object
  |
  +--org.ssonet.mechanisms.accountability.AbstractAccountabilityMechanism
All Implemented Interfaces:
IOStream, Mechanism
Direct Known Subclasses:
DSA, RSA

public class AbstractAccountabilityMechanism
extends java.lang.Object
implements IOStream, Mechanism


Field Summary
protected  boolean debug
           
protected  boolean EOF
           
protected  org.ssonet.util.ByteFIFO inBuffer
           
protected static int INBUFFER_SIZE
           
protected  org.ssonet.io.IOStream ioStream
           
protected  int[] keyLengths
           
protected  java.lang.String mechanismName
           
protected  byte[] messageBuffer
           
protected  java.lang.String[] modes
           
protected  org.ssonet.mechanisms.MechanismConfiguration negotiatedMechConf
           
protected  java.lang.String[] providers
           
protected  int readBlockNumber
           
protected  java.io.IOException readException
           
protected  int readMode
           
protected  int[] rounds
           
protected  int securityGoal
           
protected  byte[] signatureBuffer
           
protected  java.security.Signature signatureIn
           
protected  java.security.Signature signatureOut
           
protected  int validBytesToRead
           
protected  java.lang.String[] variants
           
protected  int writeBlockNumber
           
 
Fields inherited from interface org.ssonet.net.Mechanism
KEYLENGTH, MODES, PROVIDERLIST, ROUNDS, VARIANTS
 
Constructor Summary
AbstractAccountabilityMechanism()
           
 
Method Summary
 int available()
           
 void closeIn()
          Closes the inputStream of the IOStream
 void closeOut()
          Closes the outputStream of the IOStream.
 org.ssonet.mechanisms.MechanismConfiguration getConfiguration()
           
 org.ssonet.mechanisms.MechanismConfiguration getDefaultConfiguration()
           
 int[] getKeyLengths()
           
 java.lang.String[] getModes()
           
 java.lang.String getName()
           
 java.lang.String[] getProviders()
           
 int[] getRounds()
           
 java.lang.String[] getVariants()
           
 void init(org.ssonet.io.IOStream ioStream, int securityGoal, org.ssonet.mechanisms.MechanismConfiguration ownMechanismConfiguration)
          Initialize without key exchange
 void init(org.ssonet.io.IOStream ioStream, int securityGoal, org.ssonet.mechanisms.MechanismConfiguration ownMechanismConfiguration, org.ssonet.mechanisms.MechanismConfiguration partnerMechanismConfiguration, org.ssonet.net.KeyExchange keyExchange)
          Initialize with key exchange
protected  void initIOStream()
          Initializes the data fields needed for the IOStream to work.
 int read(byte[] buffer)
          reads an array of bytes from the IOStream
 byte[] testDecrypt(byte[] buffer)
          Checking a signature
 byte[] testEncrypt(byte[] buffer)
          Signing a byte array
 void write(byte[] buffer)
          Writes an array of bytes to the IOStream.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

debug

protected boolean debug

mechanismName

protected java.lang.String mechanismName

keyLengths

protected int[] keyLengths

modes

protected java.lang.String[] modes

providers

protected java.lang.String[] providers

rounds

protected int[] rounds

variants

protected java.lang.String[] variants

signatureIn

protected java.security.Signature signatureIn

signatureOut

protected java.security.Signature signatureOut

ioStream

protected org.ssonet.io.IOStream ioStream

securityGoal

protected int securityGoal

negotiatedMechConf

protected org.ssonet.mechanisms.MechanismConfiguration negotiatedMechConf

inBuffer

protected org.ssonet.util.ByteFIFO inBuffer

INBUFFER_SIZE

protected static int INBUFFER_SIZE

messageBuffer

protected byte[] messageBuffer

signatureBuffer

protected byte[] signatureBuffer

EOF

protected boolean EOF

readException

protected java.io.IOException readException

validBytesToRead

protected int validBytesToRead

readMode

protected int readMode

readBlockNumber

protected int readBlockNumber

writeBlockNumber

protected int writeBlockNumber
Constructor Detail

AbstractAccountabilityMechanism

public AbstractAccountabilityMechanism()
Method Detail

available

public int available()
              throws java.io.IOException
Specified by:
available in interface IOStream
Returns:
the number of bits available from the IOStream without blocking.
java.io.IOException

closeIn

public void closeIn()
             throws java.io.IOException
Closes the inputStream of the IOStream

Specified by:
closeIn in interface IOStream
java.io.IOException

closeOut

public void closeOut()
              throws java.io.IOException
Closes the outputStream of the IOStream.

Specified by:
closeOut in interface IOStream
java.io.IOException

getDefaultConfiguration

public org.ssonet.mechanisms.MechanismConfiguration getDefaultConfiguration()
Specified by:
getDefaultConfiguration in interface Mechanism
Returns:
a default configuration setting for the mechanism.

init

public void init(org.ssonet.io.IOStream ioStream,
                 int securityGoal,
                 org.ssonet.mechanisms.MechanismConfiguration ownMechanismConfiguration)
Initialize without key exchange

Specified by:
init in interface Mechanism
Parameters:
ioStream - mechanism IOStream
securityGoal - the security goal, for which the algorithm is used
ownMechanismConfiguration - own mechanism configuration

init

public void init(org.ssonet.io.IOStream ioStream,
                 int securityGoal,
                 org.ssonet.mechanisms.MechanismConfiguration ownMechanismConfiguration,
                 org.ssonet.mechanisms.MechanismConfiguration partnerMechanismConfiguration,
                 org.ssonet.net.KeyExchange keyExchange)
          throws ParameterNotCompatibleException
Initialize with key exchange

Specified by:
init in interface Mechanism
Parameters:
ioStream - mechanism IOStream
securityGoal - the security goal, for which the algorithm is used
ownMechanismConfiguration - own mechanism configuration
partnerMechanismConfiguration - partner mechanism configuration
keyExchange - prepared key exchange protocol
ParameterNotCompatibleException

testEncrypt

public byte[] testEncrypt(byte[] buffer)
Signing a byte array

Specified by:
testEncrypt in interface Mechanism
Parameters:
buffer - the buffer to apply the mechanism to
Returns:
a buffer holding the output of the mechanism

testDecrypt

public byte[] testDecrypt(byte[] buffer)
Checking a signature

Specified by:
testDecrypt in interface Mechanism
Parameters:
buffer - the buffer to apply the mechanism to
Returns:
a buffer holding the output of the mechanism

read

public int read(byte[] buffer)
         throws java.io.IOException
reads an array of bytes from the IOStream

Specified by:
read in interface IOStream
Parameters:
buffer - the buffer to be filled during the read operation
Returns:
the number of bytes read, or -1 if EOF is reached
Throws:
java.io.IOException - if an error occures while reading from the IOStream

write

public void write(byte[] buffer)
           throws java.io.IOException
Writes an array of bytes to the IOStream. If the security goal is SSONETConstants.ACCOUNTABILITY_SIGN, the data is signed. Otherwise, it is just written to the stream.

Specified by:
write in interface IOStream
Parameters:
buffer - the byte array to write to the stream (signed)
Throws:
java.io.IOException - if something went wrong while writing to the ioStream

initIOStream

protected void initIOStream()
Initializes the data fields needed for the IOStream to work. Thist method must be called by mechanisms extending this class in their initialization methods.


getConfiguration

public org.ssonet.mechanisms.MechanismConfiguration getConfiguration()
Specified by:
getConfiguration in interface Mechanism
Returns:
the mechanism configuration of this mechanism after it was initialized by one of the init methods, or null if the mechanism was not allready initialized.

getModes

public java.lang.String[] getModes()
Specified by:
getModes in interface Mechanism
Returns:
valid operation modes of the mechanism.

getProviders

public java.lang.String[] getProviders()
Specified by:
getProviders in interface Mechanism
Returns:
valid crypto providers for the mechanism

getVariants

public java.lang.String[] getVariants()
Specified by:
getVariants in interface Mechanism
Returns:
valid variants for the mechanism

getKeyLengths

public int[] getKeyLengths()
Specified by:
getKeyLengths in interface Mechanism
Returns:
valid keylengths for the mechanism

getRounds

public int[] getRounds()
Specified by:
getRounds in interface Mechanism
Returns:
valid rounds for the mechanism

getName

public java.lang.String getName()
Specified by:
getName in interface Mechanism
Returns:
name of the mechanism


Copyright © 2003 DRIM Team. All Rights Reserved.