Package org.netxms.base
Class EncryptedPassword
java.lang.Object
org.netxms.base.EncryptedPassword
Utility class to encrypt and decrypt passwords in same way as nxcencpasswd do.
Please note that this functionality does not provide any protection for the passwords -
it's only allows to store passwords in configuration files in a not-immediately-readable form,
as required by some security standards.
-
Constructor Summary
-
Method Summary
-
Constructor Details
-
EncryptedPassword
public EncryptedPassword()
-
-
Method Details
-
encrypt
public static String encrypt(String login, String password) throws NoSuchAlgorithmException, UnsupportedEncodingException Encrypt password for given login.- Parameters:
login
- login namepassword
- plain text password- Returns:
- password obfuscated wiht ICE algorithm
- Throws:
NoSuchAlgorithmException
- if any of required encryption algorithms are not availableUnsupportedEncodingException
- if UTF-8 encoding is not supported
-
decrypt
public static String decrypt(String login, String password) throws NoSuchAlgorithmException, IllegalArgumentException, IOException - Parameters:
login
- login namepassword
- ICE-obfuscated password- Returns:
- clear-text password
- Throws:
NoSuchAlgorithmException
- if any of required encryption algorithms are not availableIOException
- if I/O error occursIllegalArgumentException
-