jason.client
Class CipherAppender

java.lang.Object
  |
  +--jason.client.Appender
        |
        +--jason.client.CipherAppender

public class CipherAppender
extends Appender

Title: Javacards As Secure Object Store

Description: CipherAppender adds security to the normal Appender

Copyright: Copyright (c) 2002

Company: University of Twente


Field Summary
protected  MyCipher cipher
          MyCipher is used only to simulate.
 
Fields inherited from class jason.client.Appender
buffer, storeLengths
 
Constructor Summary
CipherAppender(MyCipher cipher)
           
CipherAppender(MyCipher cipher, boolean storeLengths)
           
 
Method Summary
protected  void appendIntern(byte[] b, int offset, int length)
          Encrypts the specified part of the byte array and appends it to the internal buffer.
 byte[] getBuffer()
          Encrypts the last pending bytes and returns the cipher text.
 
Methods inherited from class jason.client.Appender
append, append, append, append, append, append, appendIntern
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

cipher

protected MyCipher cipher
MyCipher is used only to simulate. In the real version this should be Cipher.

Constructor Detail

CipherAppender

public CipherAppender(MyCipher cipher)
Parameters:
cipher - The cipher to be used. It should already been initialized.

CipherAppender

public CipherAppender(MyCipher cipher,
                      boolean storeLengths)
Parameters:
cipher - The cipher to be used. It should already been initialized.
storeLengths - Indicate whether the length of an array should be stored as well
Method Detail

appendIntern

protected void appendIntern(byte[] b,
                            int offset,
                            int length)
Encrypts the specified part of the byte array and appends it to the internal buffer.

Overrides:
appendIntern in class Appender
Parameters:
b - Data to be appended
offset - Offset within b
length - Length of the bytes to be copied

getBuffer

public byte[] getBuffer()
Encrypts the last pending bytes and returns the cipher text. After a call to getBuffer no more bytes should be added to it.

Overrides:
getBuffer in class Appender
Returns:
The cipher text