Package org.refcodes.security.ext.spring
Class TextDecrypterBean
- java.lang.Object
-
- org.refcodes.security.ext.spring.TextDecrypterBean
-
- All Implemented Interfaces:
org.springframework.beans.factory.FactoryBean<java.lang.String>
public class TextDecrypterBean extends java.lang.Object implements org.springframework.beans.factory.FactoryBean<java.lang.String>
The sole purpose of the bean is not to store any passwords in clear text in a text file. It decrypt any encrypted passwords with a hard coded SEED. This means that any hacker decompiling the code will be able to gain knowledge on how to create plain text from the encrypted passwords in a configuration file. Additional measures have to be undertaken in order to restrict access to the program codes or configuration files by any intruder. The password itself is stored as a byte array, so it is not stored as clear text in the class files neither. Any further obfuscation has not been approached as in the end it will not provide any further security due to the fact that the password must be accessible somehow and automatically be decryptable by program code.ATTENTION: This bean just provides support for not storing any passwords in clear text!
-
-
Constructor Summary
Constructors Constructor Description TextDecrypterBean()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
getObject()
java.lang.Class<?>
getObjectType()
boolean
isSingleton()
void
setEncryptedText(java.lang.String aEncryptedText)
Sets the encrypted string to be decrypted and passed the the consuming bean.static java.lang.String
toEncryptedText(java.lang.String aText)
Helper method to encrypt a string which can be used in a configuration file.
-
-
-
Method Detail
-
setEncryptedText
public void setEncryptedText(java.lang.String aEncryptedText)
Sets the encrypted string to be decrypted and passed the the consuming bean.- Parameters:
aEncryptedText
- the encrypted string to be decrypted.
-
getObject
public java.lang.String getObject()
- Specified by:
getObject
in interfaceorg.springframework.beans.factory.FactoryBean<java.lang.String>
-
getObjectType
public java.lang.Class<?> getObjectType()
- Specified by:
getObjectType
in interfaceorg.springframework.beans.factory.FactoryBean<java.lang.String>
-
isSingleton
public boolean isSingleton()
- Specified by:
isSingleton
in interfaceorg.springframework.beans.factory.FactoryBean<java.lang.String>
-
toEncryptedText
public static java.lang.String toEncryptedText(java.lang.String aText)
Helper method to encrypt a string which can be used in a configuration file.- Parameters:
aText
- the text string to be encrypted.- Returns:
- the string
-
-