|
Jive Forums API (5.5.20.2-oracle) Developer Javadocs | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.jivesoftware.util.EncryptionUtil
public class EncryptionUtil
A utility for encrypting strings using different algorithms. All strings are in hex format. The default algorithm for this class is Blowfish.
Constructor Summary | |
---|---|
EncryptionUtil(java.lang.String key)
Creates a EncryptionUtil class that uses the algorithm specified by the jive proeprty jive.crypto.algorithm, if the property is not specified then "Blowfish/ECB/PKCS5Padding" will be used. |
|
EncryptionUtil(java.lang.String key,
java.lang.String algorithm)
Creates an encryption utility using the specified algorithm |
Method Summary | |
---|---|
java.lang.String |
decryptString(java.lang.String cipherText)
Decrypt the string using the cipher that this class was initialized with. |
java.lang.String |
encryptString(java.lang.String plainText)
Encrypts the string using the cipher that this class was initialized with. |
static java.lang.String |
generateSecretKey()
Generates a new secret key using the Blowfish algorithm unless there is another specified by the jive property jive.crypto.algorithm. |
static java.lang.String |
generateSecretKey(java.lang.String algorithm)
Generates a new secret key using the specified algorithm. |
static java.lang.String |
storeNewKeyInProperty(java.lang.String jiveProperty)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public EncryptionUtil(java.lang.String key) throws java.security.NoSuchAlgorithmException, java.security.InvalidKeyException, javax.crypto.NoSuchPaddingException
key
- Secret key used for encryption/decryption
java.security.NoSuchAlgorithmException
java.security.InvalidKeyException
javax.crypto.NoSuchPaddingException
public EncryptionUtil(java.lang.String key, java.lang.String algorithm) throws java.security.InvalidKeyException, java.security.NoSuchAlgorithmException, javax.crypto.NoSuchPaddingException
key
- Secret key used for encryption/decryptionalgorithm
- The name of the algorithm (ie "Blowfish" or "DES").
java.security.InvalidKeyException
java.security.NoSuchAlgorithmException
javax.crypto.NoSuchPaddingException
Method Detail |
---|
public java.lang.String encryptString(java.lang.String plainText) throws javax.crypto.BadPaddingException, javax.crypto.IllegalBlockSizeException
plainText
- The string to encrypt.
javax.crypto.BadPaddingException
javax.crypto.IllegalBlockSizeException
public java.lang.String decryptString(java.lang.String cipherText) throws javax.crypto.IllegalBlockSizeException
cipherText
- String in hex format.
javax.crypto.IllegalBlockSizeException
public static java.lang.String generateSecretKey()
public static java.lang.String generateSecretKey(java.lang.String algorithm) throws java.security.NoSuchAlgorithmException
algorithm
- The encryption algorithm.
java.security.NoSuchAlgorithmException
- Thrown if the algorithm doesn't exist.public static java.lang.String storeNewKeyInProperty(java.lang.String jiveProperty)
|
Jive Forums Project Page | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |