Package info.freelibrary.util
Class PasswordUtils
- java.lang.Object
-
- info.freelibrary.util.PasswordUtils
-
public final class PasswordUtils extends Object
Utilities for use with password creation.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static String
encrypt(String aText)
Encrypts the supplied text.static String
encrypt(String aText, String aSalt)
Encrypts the supplied text using the supplied salt.static String
generateSalt()
Generates a salt for working with passwords.
-
-
-
Method Detail
-
generateSalt
public static String generateSalt()
Generates a salt for working with passwords.- Returns:
- A salt
-
encrypt
public static String encrypt(String aText) throws IOException
Encrypts the supplied text.- Parameters:
aText
- The text to be encrypted- Returns:
- The encrypted password
- Throws:
IOException
- If there is trouble encrypting the supplied text
-
encrypt
public static String encrypt(String aText, String aSalt) throws IOException
Encrypts the supplied text using the supplied salt.- Parameters:
aText
- The text to be encryptedaSalt
- The salt to use in the encryption- Returns:
- The encrypted password
- Throws:
IOException
- If there is trouble encrypting the supplied text
-
-