DBAbstract API Documentation

ro.raducora.utils.encryption.key
Class StreamEncryptionKey

java.lang.Object
  |
  +--ro.raducora.utils.encryption.key.StreamEncryptionKey
All Implemented Interfaces:
java.lang.Cloneable
Direct Known Subclasses:
DefaultEncryptionKey, RC4EncryptionKey

public abstract class StreamEncryptionKey
extends java.lang.Object
implements java.lang.Cloneable

Author:
Radu Coravu

Constructor Summary
StreamEncryptionKey()
           
 
Method Summary
 java.lang.Object clone()
          Clone Supported.
abstract  byte[] decrypt(byte[] toDecrypt, int offset, int length)
          Takes an array of bytes and decrypts it
abstract  byte[] encrypt(byte[] toEncrypt, int offset, int length)
          Takes an array of bytes and encodes it with key
abstract  boolean isExplicitlySet()
           
abstract  void reset()
          Resets the encryption/decryption process,initializez variables,etc so that the key can be used as a brand new one
abstract  void setKey(java.lang.String key)
          Takes a string and makes a key
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StreamEncryptionKey

public StreamEncryptionKey()
Method Detail

clone

public java.lang.Object clone()
                       throws java.lang.CloneNotSupportedException
Clone Supported.

Overrides:
clone in class java.lang.Object
java.lang.CloneNotSupportedException

setKey

public abstract void setKey(java.lang.String key)
                     throws java.lang.Exception
Takes a string and makes a key

Parameters:
key - the String
java.lang.Exception

isExplicitlySet

public abstract boolean isExplicitlySet()
Returns:
True if the key was initialized with a non-default constructor or with the setKey method and false if the key was initialised with the default constructor

reset

public abstract void reset()
                    throws java.lang.Exception
Resets the encryption/decryption process,initializez variables,etc so that the key can be used as a brand new one

java.lang.Exception

encrypt

public abstract byte[] encrypt(byte[] toEncrypt,
                               int offset,
                               int length)
Takes an array of bytes and encodes it with key

Parameters:
toEncrypt - bytes to encrypt
offset - where to begin
length - how many bytes to process
Returns:
the encrypted array(could be different size than input because of padding)

decrypt

public abstract byte[] decrypt(byte[] toDecrypt,
                               int offset,
                               int length)
Takes an array of bytes and decrypts it

Parameters:
toDecrypt - bytes to decrypt
offset - where to begin
length - how many bytes to process
Returns:
the decrypted array(could be different size than input because of padding removal)

DBAbstract API Documentation

© Copyright Radu Coravu 2002 - 2004.