Openfire 3.9.3 Javadoc

org.jivesoftware.util
Class Blowfish

java.lang.Object
  extended by org.jivesoftware.util.Blowfish
All Implemented Interfaces:
Encryptor

public class Blowfish
extends Object
implements Encryptor

A class that provides easy Blowfish encryption.

Author:
Markus Hahn <markus_hahn@gmx.net>, Gaston Dombiak

Constructor Summary
Blowfish()
          Creates a new Blowfish object using the default key
Blowfish(String password)
          Creates a new Blowfish object using the specified key (oversized password will be cut).
 
Method Summary
 String decrypt(String value)
          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 anymore
 String encrypt(String value)
          Encrypt a clear text String.
 String encryptString(String sPlainText)
          Encrypts a string (treated in UNICODE) using the standard Java random generator, which isn't that great for creating IVs
 void setKey(String key)
          Set the encryption key.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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) using the standard Java random generator, which isn't that great for creating IVs

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.

Specified by:
encrypt in interface Encryptor
Parameters:
value - The clear text attribute
Returns:
The encrypted attribute, or null

decrypt

public String decrypt(String value)
Description copied from interface: Encryptor
Decrypt an encrypted String.

Specified by:
decrypt in interface Encryptor
Parameters:
value - The encrypted attribute in Base64 encoding
Returns:
The clear text attribute, or null

setKey

public void setKey(String key)
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.

Specified by:
setKey in interface Encryptor
Parameters:
key - The encryption key

Openfire 3.9.3 Javadoc

Copyright © 2003-2008 Jive Software.