DBAbstract API Documentation

ro.raducora.utils.encryption.key
Class DefaultEncryptionKey

java.lang.Object
  |
  +--ro.raducora.utils.encryption.key.StreamEncryptionKey
        |
        +--ro.raducora.utils.encryption.key.DefaultEncryptionKey
All Implemented Interfaces:
java.lang.Cloneable

public class DefaultEncryptionKey
extends StreamEncryptionKey

Author:
Radu Coravu

Constructor Summary
DefaultEncryptionKey()
          Sets the internal key with help from current system time
DefaultEncryptionKey(long longkey)
          Constructor that takes a "long" as argument
DefaultEncryptionKey(java.lang.String strkey)
          Constructor that takes a String as argument
 
Method Summary
 byte[] decrypt(byte[] toDecrypt, int offset, int length)
          Takes an array of bytes and decrypts it
 byte[] encrypt(byte[] toEncrypt, int offset, int length)
          Takes an array of bytes and encodes it with key
 boolean isExplicitlySet()
           
 void reset()
          Set Key to initial state.
 void setKey(java.lang.String key)
          Set Key
 
Methods inherited from class ro.raducora.utils.encryption.key.StreamEncryptionKey
clone
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultEncryptionKey

public DefaultEncryptionKey()
Sets the internal key with help from current system time


DefaultEncryptionKey

public DefaultEncryptionKey(long longkey)
Constructor that takes a "long" as argument


DefaultEncryptionKey

public DefaultEncryptionKey(java.lang.String strkey)
Constructor that takes a String as argument

Method Detail

isExplicitlySet

public boolean isExplicitlySet()
Specified by:
isExplicitlySet in class StreamEncryptionKey
Returns:
true if key is explicitly set

reset

public void reset()
Set Key to initial state.

Specified by:
reset in class StreamEncryptionKey

setKey

public void setKey(java.lang.String key)
Set Key

Specified by:
setKey in class StreamEncryptionKey
Parameters:
key - the key to set.

encrypt

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

Specified by:
encrypt in class StreamEncryptionKey
Parameters:
toEncrypt - byte array to encrypt
offset - where to begin
length - where to end
Returns:
the encrypted byte[]

decrypt

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

Specified by:
decrypt in class StreamEncryptionKey
Parameters:
toDecrypt - byte array to decrypt
offset - where to begin
length - where to end
Returns:
the decrypted byte[]

DBAbstract API Documentation

© Copyright Radu Coravu 2002 - 2004.