Package org.refcodes.security
Class SecurityUtility
- java.lang.Object
-
- org.refcodes.security.SecurityUtility
-
- All Implemented Interfaces:
org.refcodes.mixin.Loggable
public final class SecurityUtility extends java.lang.Object implements org.refcodes.mixin.Loggable
The Class SecurityUtility.
-
-
Field Summary
Fields Modifier and Type Field Description static int
CIPHER_LENGTH
static int
CIPHER_UID_LENGTH
static int
CIPHER_UID_TIMESTAMP_LENGTH
static int
MESSAGE_LENGTH
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.String
toDecryptedText(java.lang.String aText)
Decrypt the given text in case it has the prefix identifying the text as being encrypted, else the plain text is returned and a warning is printed out that the passed text is not encrypted (just the first two or three chars or zero chars are shown depending on the length of the text). ------------------------------------------------------------------------- Attention: A unique system ID is used for decryption.static java.lang.String
toDecryptedText(java.lang.String aText, java.lang.String aPassPharse)
Decrypt the given text in case it has the prefix identifying the text as being encrypted, else the plain text is returned and a warning is printed out that the passed text is not encrypted (just the first two or three chars or zero chars are shown depending on the length of the text).static java.lang.String
toEncryptedText(java.lang.String aText)
Encrypts the given text and prepends a prefix identifying the text as being encrypted. ------------------------------------------------------------------------- Attention: A unique system ID is used for encryption.static java.lang.String
toEncryptedText(java.lang.String aText, java.lang.String aPassPhrase)
Encrypts the given text and prepends a prefix identifying the text as being encrypted.
-
-
-
Field Detail
-
CIPHER_UID_TIMESTAMP_LENGTH
public static final int CIPHER_UID_TIMESTAMP_LENGTH
- See Also:
- Constant Field Values
-
CIPHER_UID_LENGTH
public static final int CIPHER_UID_LENGTH
- See Also:
- Constant Field Values
-
CIPHER_LENGTH
public static final int CIPHER_LENGTH
- See Also:
- Constant Field Values
-
MESSAGE_LENGTH
public static final int MESSAGE_LENGTH
- See Also:
- Constant Field Values
-
-
Method Detail
-
toDecryptedText
public static java.lang.String toDecryptedText(java.lang.String aText)
Decrypt the given text in case it has the prefix identifying the text as being encrypted, else the plain text is returned and a warning is printed out that the passed text is not encrypted (just the first two or three chars or zero chars are shown depending on the length of the text). ------------------------------------------------------------------------- Attention: A unique system ID is used for decryption. Decryption with this method will only work on the same system used for encryption viatoEncryptedText(String)
! ------------------------------------------------------------------------- This method is most useful for encrypting passwords or authentication credentials in configuration files on live servers to provide at least a minimum of security.- Parameters:
aText
- The text being decrypted.- Returns:
- The decrypted text.
-
toDecryptedText
public static java.lang.String toDecryptedText(java.lang.String aText, java.lang.String aPassPharse)
Decrypt the given text in case it has the prefix identifying the text as being encrypted, else the plain text is returned and a warning is printed out that the passed text is not encrypted (just the first two or three chars or zero chars are shown depending on the length of the text).- Parameters:
aText
- The text being decrypted.aPassPharse
- The pass phrase for decrypting.- Returns:
- The decrypt
-
toEncryptedText
public static java.lang.String toEncryptedText(java.lang.String aText)
Encrypts the given text and prepends a prefix identifying the text as being encrypted. ------------------------------------------------------------------------- Attention: A unique system ID is used for encryption. Decryption with thetoDecryptedText(String)
method will only work on the same system used for encryption via this method! ------------------------------------------------------------------------- This method is most useful for encrypting passwords or authentication credentials in configuration files on live servers to provide at least a minimum of security.- Parameters:
aText
- The text to be encrypted.- Returns:
- The encrypted text with the encryption identifier prefixed.
-
toEncryptedText
public static java.lang.String toEncryptedText(java.lang.String aText, java.lang.String aPassPhrase)
Encrypts the given text and prepends a prefix identifying the text as being encrypted.- Parameters:
aText
- The text to be encrypted.aPassPhrase
- The pass phrase for the encrypted text.- Returns:
- The encrypted text with the encryption identifier prefixed.
-
-