Package org.jivesoftware.util
Class Blowfish
- java.lang.Object
-
- org.jivesoftware.util.Blowfish
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
decrypt(String value)
Decrypt an encrypted String.String
decrypt(String value, byte[] iv)
Decrypt an encrypted String.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 anymoreString
encrypt(String value)
Encrypt a clear text String.String
encrypt(String value, byte[] iv)
Encrypt a clear text String.String
encryptString(String sPlainText)
Encrypts a string (treated in UNICODE).void
setKey(String key)
Set the encryption key.
-
-
-
Constructor Detail
-
Blowfish
public Blowfish()
Creates a new Blowfish object using the default key
-
Blowfish
public Blowfish(String password)
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 Detail
-
encryptString
public String encryptString(String sPlainText)
Encrypts a string (treated in UNICODE).- Parameters:
sPlainText
- string to encrypt- Returns:
- encrypted string in binhex format
-
decryptString
public String decryptString(String sCipherText)
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
public String encrypt(String value)
Description copied from interface:Encryptor
Encrypt a clear text String.
-
encrypt
public String encrypt(String value, byte[] iv)
Description copied from interface:Encryptor
Encrypt a clear text String.
-
decrypt
public String decrypt(String value)
Description copied from interface:Encryptor
Decrypt an encrypted String.
-
decrypt
public String decrypt(String value, byte[] iv)
Description copied from interface:Encryptor
Decrypt an encrypted String.
-
-