Package com.ebasetech.xi.services
Class EncryptionServices
java.lang.Object
com.ebasetech.xi.services.EncryptionServices
- All Implemented Interfaces:
 java.io.Serializable
public class EncryptionServices
extends java.lang.Object
implements java.io.Serializable
Encryption and decryption services
- Since:
 - V4.4
 - See Also:
 - Serialized Form
 
- 
Constructor Summary
Constructors Constructor Description EncryptionServices() - 
Method Summary
Modifier and Type Method Description static java.lang.Stringdecrypt(java.lang.String message)Deprecated.static java.lang.Stringdecrypt(java.lang.String message, int count, java.lang.String key)Deprecated.from V5.3 usedecryptAES(String, String)insteadstatic java.lang.StringdecryptAES(java.lang.String message)Decrypts a Base64 encoded string represented bymessageusing the AES algorithm and a 128 bit key with default encryption parameters.static java.lang.StringdecryptAES(java.lang.String message, java.lang.String key)Decrypts a Base64 encoded string represented bymessageusing the AES algorithm and a 128 bit key.static java.lang.StringdecryptAES(java.lang.String message, java.lang.String key, int iterations)Decrypts a Base64 encoded string represented bymessageusing the AES algorithm and a 128 bit key.static java.lang.Stringencrypt(java.lang.String message)Deprecated.from V5.3 useencryptAES(String)insteadstatic java.lang.Stringencrypt(java.lang.String message, int count, java.lang.String key)Deprecated.from V5.3 useencryptAES(String, String)insteadstatic java.lang.StringencryptAES(java.lang.String message)Returns a Base64 encoded Encrypted string represented bymessageusing the AES algorithm and a 128 bit key with default encryption parameters.static java.lang.StringencryptAES(java.lang.String message, java.lang.String key)Returns a Base64 encoded Encrypted string represented bymessageusing the AES algorithm and a 128 bit key.static java.lang.StringencryptAES(java.lang.String message, java.lang.String key, int iterations)Returns a Base64 encoded Encrypted string represented bymessageusing the AES algorithm and a 128 bit key.static java.lang.StringgenerateHash(java.lang.String message, int iterations, java.lang.String salt)Hashes a string represented bymessageusing the PBKDF2WithHmacSHA512 algorithm and a 512 bit key.static java.lang.StringgenerateRandomSalt(int bytes)Generates a salt suitable for generateHash.Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait 
- 
Constructor Details
- 
EncryptionServices
public EncryptionServices() 
 - 
 - 
Method Details
- 
generateHash
public static java.lang.String generateHash(java.lang.String message, int iterations, java.lang.String salt) throws com.ebasetech.xi.exceptions.FormRuntimeExceptionHashes a string represented bymessageusing the PBKDF2WithHmacSHA512 algorithm and a 512 bit key.- Parameters:
 message- The message to be hashediterations- The iterations argument specifies how many times the PBKDF2 executes its underlying algorithm. A higher value is safersalt- should be random data and vary for each user. Remember to save the salt with the hashed password- Returns:
 - Base64 encoded hashed string
 - Throws:
 com.ebasetech.xi.exceptions.FormRuntimeException- if any error occurs- Since:
 - v5.3
 
 - 
generateRandomSalt
public static java.lang.String generateRandomSalt(int bytes) throws com.ebasetech.xi.exceptions.FormRuntimeExceptionGenerates a salt suitable for generateHash.- Parameters:
 bytes- the number of bytes in the salt. e.g. 32- Returns:
 - A random byte array encoded as Base64. Will be longer than number of bytes.
 - Throws:
 com.ebasetech.xi.exceptions.FormRuntimeException
 - 
encryptAES
public static java.lang.String encryptAES(java.lang.String message, java.lang.String key, int iterations) throws com.ebasetech.xi.exceptions.FormRuntimeExceptionReturns a Base64 encoded Encrypted string represented bymessageusing the AES algorithm and a 128 bit key.- Parameters:
 message- string to be encryptedkey- key used by the encryption algorithm; if null, the default is used (seeencryptAES(String))iterations- number of times to encrypt the string. This number must be 1 or greater- Returns:
 - Base64 encoded encrypted string
 - Throws:
 com.ebasetech.xi.exceptions.FormRuntimeException- if any error occurs- Since:
 - V5.3
 - See Also:
 encryptAES(String),encryptAES(String, String)
 - 
encryptAES
public static java.lang.String encryptAES(java.lang.String message, java.lang.String key) throws com.ebasetech.xi.exceptions.FormRuntimeExceptionReturns a Base64 encoded Encrypted string represented bymessageusing the AES algorithm and a 128 bit key.- Parameters:
 message- string to be encryptedkey- key used by the encryption algorithm; if null, the default is used (seeencryptAES(String))- Returns:
 - Base64 encoded encrypted string
 - Throws:
 com.ebasetech.xi.exceptions.FormRuntimeException- if any error occurs- Since:
 - V5.3
 - See Also:
 encryptAES(String)
 - 
encryptAES
public static java.lang.String encryptAES(java.lang.String message) throws com.ebasetech.xi.exceptions.FormRuntimeExceptionReturns a Base64 encoded Encrypted string represented bymessageusing the AES algorithm and a 128 bit key with default encryption parameters.- Parameters:
 message- the string to be encrypted- Returns:
 - Base64 encoded encrypted string
 - Throws:
 com.ebasetech.xi.exceptions.FormRuntimeException- if any error occurs- Since:
 - V5.3
 - See Also:
 encryptAES(String, String)
 - 
decryptAES
public static java.lang.String decryptAES(java.lang.String message, java.lang.String key, int iterations) throws com.ebasetech.xi.exceptions.FormRuntimeExceptionDecrypts a Base64 encoded string represented bymessageusing the AES algorithm and a 128 bit key.- Parameters:
 message- Base64 encoded string to be decryptedkey- key used by the decrytion algorithm; if null, the default is used (seedecryptAES(String))iterations- number of times to decrypt the encrypted string. The number of iterations must match the iterations when encrypting the string.- Returns:
 - decrypted string
 - Throws:
 com.ebasetech.xi.exceptions.FormRuntimeException- if any error occurs, usually the message is not in the correct encrypted format- Since:
 - V5.3
 - See Also:
 decryptAES(String),decryptAES(String, String),encryptAES(String, String, int)
 - 
decryptAES
public static java.lang.String decryptAES(java.lang.String message, java.lang.String key) throws com.ebasetech.xi.exceptions.FormRuntimeExceptionDecrypts a Base64 encoded string represented bymessageusing the AES algorithm and a 128 bit key.- Parameters:
 message- Base64 encoded string to be decryptedkey- key used by the decrytion algorithm; if null, the default is used (seedecryptAES(String))- Returns:
 - decrypted string
 - Throws:
 com.ebasetech.xi.exceptions.FormRuntimeException- if any error occurs, usually the message is not in the correct encrypted format- Since:
 - V5.3
 - See Also:
 decryptAES(String)
 - 
decryptAES
public static java.lang.String decryptAES(java.lang.String message) throws com.ebasetech.xi.exceptions.FormRuntimeExceptionDecrypts a Base64 encoded string represented bymessageusing the AES algorithm and a 128 bit key with default encryption parameters.- Parameters:
 message- the string to be decrypted- Returns:
 - decrypted string
 - Throws:
 com.ebasetech.xi.exceptions.FormRuntimeException- if any error occurs, usually the message is not in the correct encrypted format- Since:
 - V5.3
 - See Also:
 decryptAES(String, String)
 - 
encrypt
@Deprecated public static java.lang.String encrypt(java.lang.String message, int count, java.lang.String key) throws com.ebasetech.xi.exceptions.FormRuntimeExceptionDeprecated.from V5.3 useencryptAES(String, String)insteadEncrypts the string represented bymessageusing the PBEWithMD5AndDES algorithm.- Parameters:
 message- string to be encryptedcount- number of times the encryption algorithm is invokedkey- key used by the encryption algorithm; if null, the default is used (seeencrypt(String))- Returns:
 - encrypted string
 - Throws:
 com.ebasetech.xi.exceptions.FormRuntimeException- if any error occurs- Since:
 - V4.4
 - See Also:
 encrypt(String)
 - 
encrypt
@Deprecated public static java.lang.String encrypt(java.lang.String message) throws com.ebasetech.xi.exceptions.FormRuntimeExceptionDeprecated.from V5.3 useencryptAES(String)insteadEncrypts the string represented bymessageusing the PBEWithMD5AndDES algorithm and with default encryption parameters.- Parameters:
 message- the string to be encrypted- Returns:
 - encrypted string
 - Throws:
 com.ebasetech.xi.exceptions.FormRuntimeException- if any error occurs- Since:
 - V4.4
 - See Also:
 encrypt(String, int, String)
 - 
decrypt
@Deprecated public static java.lang.String decrypt(java.lang.String message, int count, java.lang.String key) throws com.ebasetech.xi.exceptions.FormRuntimeExceptionDeprecated.from V5.3 usedecryptAES(String, String)insteadDecrypts the string represented bymessageusing the PBEWithMD5AndDES algorithm.- Parameters:
 message- string to be decryptedcount- number of times the encryption algorithm is invokedkey- key used by the decrytion algorithm; if null, the default is used (seedecrypt(String))- Returns:
 - decrypted string
 - Throws:
 com.ebasetech.xi.exceptions.FormRuntimeException- if any error occurs, usually the message is not in the correct encrypted format- Since:
 - V4.4
 - See Also:
 decrypt(String)
 - 
decrypt
@Deprecated public static java.lang.String decrypt(java.lang.String message) throws com.ebasetech.xi.exceptions.FormRuntimeExceptionDeprecated.from V5.3 usedecryptAES(String)insteadDecrypts the string represented bymessageusing the PBEWithMD5AndDES algorithm and with default encryption parameters.- Parameters:
 message- the string to be decrypted- Returns:
 - decrypted string
 - Throws:
 com.ebasetech.xi.exceptions.FormRuntimeException- if any error occurs, usually the message is not in the correct encrypted format- Since:
 - V4.4
 - See Also:
 decrypt(String, int, String)
 
 - 
 
decryptAES(String)instead