goldengate.common.crypto
Class KeyManager

java.lang.Object
  extended by goldengate.common.crypto.KeyManager
Direct Known Subclasses:
AesManager, BlowfishManager, DesManager, DynamicKeyManager

public abstract class KeyManager
extends Object

This class implements a simple Key Manager from name

Author:
frederic bregier

Constructor Summary
KeyManager()
           
 
Method Summary
abstract  KeyObject createKeyObject()
           
 String crypt(String keyName, String toBeCrypted)
          One method to get the crypted String from the given string and key
 String decrypt(String keyName, String toBeDecrypted)
          One method to get the uncrypted String from the given crypted string and key
 KeyObject getKey(String name)
           
 List<String> initFromList(List<String> keys, String extension)
          Init the Manager from a list of filename Key, the key name is the basename minus the extension
 void saveToFiles(String extension)
           
 void setKey(String name, KeyObject keyObject)
          Add or set a new key associated to the given name
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

KeyManager

public KeyManager()
Method Detail

createKeyObject

public abstract KeyObject createKeyObject()

initFromList

public List<String> initFromList(List<String> keys,
                                 String extension)
Init the Manager from a list of filename Key, the key name is the basename minus the extension

Parameters:
keys -
extension -
Returns:
the list of wrong keys

saveToFiles

public void saveToFiles(String extension)
                 throws CryptoException,
                        IOException
Throws:
CryptoException
IOException

setKey

public void setKey(String name,
                   KeyObject keyObject)
Add or set a new key associated to the given name

Parameters:
name -
keyObject -

getKey

public KeyObject getKey(String name)
Parameters:
name -
Returns:
the key associated to the given name

crypt

public String crypt(String keyName,
                    String toBeCrypted)
             throws Exception
One method to get the crypted String from the given string and key

Parameters:
keyName -
toBeCrypted -
Returns:
the crypted String
Throws:
Exception

decrypt

public String decrypt(String keyName,
                      String toBeDecrypted)
               throws Exception
One method to get the uncrypted String from the given crypted string and key

Parameters:
keyName -
toBeDecrypted -
Returns:
the uncrypted String
Throws:
Exception


Copyright © 2009-2012 Frederic Bregier. All Rights Reserved.