org.jscience.util
Class CypherKey

java.lang.Object
  extended by org.jscience.util.CypherKey
All Implemented Interfaces:
SynchronousKey

public class CypherKey
extends java.lang.Object
implements SynchronousKey

CypherKey provides a very easy-to-use, yet effective encryption mechanism. The key (including the password) is transient.


Constructor Summary
CypherKey(char[] password)
          Creates a new CypherKey object.
CypherKey(java.lang.String algorithm, byte[] salt, int iterationCount, char[] password)
          Creates a new CypherKey object.
 
Method Summary
 byte[] decode(byte[] encrypted)
          decodes the given byte array
 byte[] encode(byte[] plainSource)
          DOCUMENT ME!
 java.lang.String getKeySignature()
          DOCUMENT ME!
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CypherKey

public CypherKey(char[] password)
          throws java.security.GeneralSecurityException
Creates a new CypherKey object.

Parameters:
password - DOCUMENT ME!
Throws:
java.security.GeneralSecurityException - DOCUMENT ME!

CypherKey

public CypherKey(java.lang.String algorithm,
                 byte[] salt,
                 int iterationCount,
                 char[] password)
          throws java.security.GeneralSecurityException
Creates a new CypherKey object.

Parameters:
algorithm - DOCUMENT ME!
salt - DOCUMENT ME!
iterationCount - DOCUMENT ME!
password - DOCUMENT ME!
Throws:
java.security.GeneralSecurityException - DOCUMENT ME!
Method Detail

decode

public byte[] decode(byte[] encrypted)
Description copied from interface: SynchronousKey
decodes the given byte array

Specified by:
decode in interface SynchronousKey
Parameters:
encrypted - DOCUMENT ME!
Returns:
DOCUMENT ME!

encode

public byte[] encode(byte[] plainSource)
DOCUMENT ME!

Specified by:
encode in interface SynchronousKey
Parameters:
plainSource - DOCUMENT ME!
Returns:
DOCUMENT ME!
Throws:
java.lang.RuntimeException - DOCUMENT ME!

getKeySignature

public java.lang.String getKeySignature()
DOCUMENT ME!

Specified by:
getKeySignature in interface SynchronousKey
Returns:
DOCUMENT ME!