ch.elca.el4j.util.encryption
Class PBEncryptor

java.lang.Object
  extended by ch.elca.el4j.util.encryption.PBEncryptor

public class PBEncryptor
extends Object

En- / decrypts strings with a key derived from a user-supplied password with java's PBEStringEncryption (DES, MD5 password hash).

Author:
David Bernhard (DBD)
File-location:
PBEncryptor
Last check-in date:
2009-08-04 15:24:14 +0200 (Di, 04. Aug 2009) by swismer for revision 3882

Constructor Summary
PBEncryptor()
          Constructor.
 
Method Summary
 String decrypt(String enc)
          Decrypts a string with the currently set password.
 void deriveKey(String password)
          Hashes the password and converts it to a suitable format for the cipher.
 String encrypt(String plain)
          Encrypts a string with the currently set password.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PBEncryptor

public PBEncryptor()
            throws EncryptionException
Constructor. As this lives in external we don't initialize with the internal password here.

Throws:
EncryptionException
Method Detail

deriveKey

public void deriveKey(String password)
               throws EncryptionException
Hashes the password and converts it to a suitable format for the cipher.

Parameters:
password - The password to generate a key from. Sets a valid key derived from the password.
Throws:
EncryptionException

encrypt

public String encrypt(String plain)
               throws EncryptionException
Encrypts a string with the currently set password.

Parameters:
plain - String.
Returns:
The encrypted string.
Throws:
EncryptionException

decrypt

public String decrypt(String enc)
               throws EncryptionException
Decrypts a string with the currently set password.

Parameters:
enc - String.
Returns:
The decrypted string.
Throws:
EncryptionException


Copyright © 2005-2011 ELCA. All Rights Reserved.