Package org.jivesoftware.util
Class Blowfish
java.lang.Object
org.jivesoftware.util.Blowfish
- All Implemented Interfaces:
Encryptor
A class that provides easy Blowfish encryption.
- Author:
- Markus Hahn <markus_hahn@gmx.net>, Gaston Dombiak
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionDecrypt an encrypted String.Decrypt an encrypted String.decryptString
(String sCipherText) decrypts a hexbin string (handling is case sensitive)void
destroy()
destroys (clears) the encryption engine, after that the instance is not valid anymoreEncrypt a clear text String.Encrypt a clear text String.encryptString
(String sPlainText) Encrypts a string (treated in UNICODE).void
Set the encryption key.
-
Constructor Details
-
Blowfish
public Blowfish()Creates a new Blowfish object using the default key -
Blowfish
Creates a new Blowfish object using the specified key (oversized password will be cut).- Parameters:
password
- the password (treated as a real unicode array)
-
-
Method Details
-
encryptString
Encrypts a string (treated in UNICODE).- Parameters:
sPlainText
- string to encrypt- Returns:
- encrypted string in binhex format
-
decryptString
decrypts a hexbin string (handling is case sensitive)- Parameters:
sCipherText
- hexbin string to decrypt- Returns:
- decrypted string (null equals an error)
-
destroy
public void destroy()destroys (clears) the encryption engine, after that the instance is not valid anymore -
encrypt
Description copied from interface:Encryptor
Encrypt a clear text String. -
encrypt
Description copied from interface:Encryptor
Encrypt a clear text String. -
decrypt
Description copied from interface:Encryptor
Decrypt an encrypted String. -
decrypt
Description copied from interface:Encryptor
Decrypt an encrypted String. -
setKey
Description copied from interface:Encryptor
Set the encryption key. This will apply the user-defined key, truncated or filled (via the default key) as needed to meet the key length specifications.
-