goldengate.common.crypto
Class Blowfish
java.lang.Object
goldengate.common.crypto.KeyObject
goldengate.common.crypto.Blowfish
public class Blowfish
- extends KeyObject
This class handles methods to crypt and decrypt messages with Blowfish (efficient: 4000/s both at 56 and 128 keysize).
Usage:
- Create a Blowfish object: Blowfish key = new Blowfish();
- Create a key:
- Generate: key.generateKey();
The method key.getSecretKeyInBytes() allow getting the key in Bytes.
- From an external source: key.setSecretKey(arrayOfBytes);
- To crypt a String in a Base64 format: String myStringCrypt = key.cryptToString(myString);
- To decrypt one string from Base64 format to the original String: String myStringDecrypt = key.decryptStringInString(myStringCrypte);
- Author:
- frederic bregier
Methods inherited from class goldengate.common.crypto.KeyObject |
crypt, crypt, cryptToHex, cryptToHex, decodeHex, decrypt, decryptHexFile, decryptHexInBytes, decryptHexInBytes, decryptHexInString, decryptInString, encodeHex, generateKey, getSecretKey, getSecretKeyInBytes, keyReady, saveSecretKey, setSecretKey, setSecretKey, setSecretKey, toCrypt, toDecrypt |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
KEY_SIZE
public static final int KEY_SIZE
- This value could be between 32 and 448. But it seems it is blocked up to 128.
- See Also:
- Constant Field Values
ALGO
public static final String ALGO
- See Also:
- Constant Field Values
INSTANCE
public static final String INSTANCE
- See Also:
- Constant Field Values
EXTENSION
public static final String EXTENSION
- See Also:
- Constant Field Values
Blowfish
public Blowfish()
getAlgorithm
public String getAlgorithm()
- Specified by:
getAlgorithm
in class KeyObject
- Returns:
- the algorithm used (Java name)
getInstance
public String getInstance()
- Specified by:
getInstance
in class KeyObject
- Returns:
- the instance used (Java name)
getKeySize
public int getKeySize()
- Specified by:
getKeySize
in class KeyObject
- Returns:
- the size for the algorithm key
main
public static void main(String[] args)
throws Exception
- This method allows to test the correctness of this class
- Parameters:
args
-
- Throws:
Exception
Copyright © 2009-2012 Frederic Bregier. All Rights Reserved.