org.ifeth.sehr.lib
Class DesEncrypter

java.lang.Object
  extended byorg.ifeth.sehr.lib.DesEncrypter

public class DesEncrypter
extends java.lang.Object

Author:
HansJHaase (refactoring some methods)

Constructor Summary
DesEncrypter()
          Parameterless Constructor
DesEncrypter(char[] key)
          Constructor with preparation of en-/decryption
 
Method Summary
 javax.crypto.CipherInputStream getCipherInputStream(java.io.FileInputStream fis)
          Input stream with cipher
 javax.crypto.CipherOutputStream getCipherOutputStream(java.io.FileOutputStream fos)
          Output stream with cipher
 javax.crypto.Cipher getDecryptionCipher()
          Get cipher for decryption
 javax.crypto.Cipher getEncryptionCipher()
          Get cipher object for encryption
 java.lang.String getErrorMessage()
          Returns the last errorMessage.
 boolean init(char[] key)
           
 boolean isValid()
          If 'true' the cipher object is usable
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DesEncrypter

public DesEncrypter()
Parameterless Constructor


DesEncrypter

public DesEncrypter(char[] key)
             throws java.lang.Exception
Constructor with preparation of en-/decryption

Throws:
java.lang.Exception
Method Detail

init

public boolean init(char[] key)

isValid

public boolean isValid()
If 'true' the cipher object is usable

Returns:
true if process was successful

getEncryptionCipher

public javax.crypto.Cipher getEncryptionCipher()
Get cipher object for encryption

Returns:
Cipher_Object 'null' if not successful, details stored in 'errorMessage'

getDecryptionCipher

public javax.crypto.Cipher getDecryptionCipher()
Get cipher for decryption

Returns:
cipher for decryption or null

getCipherInputStream

public javax.crypto.CipherInputStream getCipherInputStream(java.io.FileInputStream fis)
Input stream with cipher

Parameters:
fis - - FileInputStream
Returns:
CipherInputStream_Object - CipherInputStream (decrypted) oder null

getCipherOutputStream

public javax.crypto.CipherOutputStream getCipherOutputStream(java.io.FileOutputStream fos)
Output stream with cipher

Parameters:
fos - - FileOutputStream
Returns:
CipherOutputStream_Object - CipherOutputStream (encrypted) oder null

getErrorMessage

public java.lang.String getErrorMessage()
Returns the last errorMessage.

Returns:
string