public class Crypto extends Object
Modifier and Type | Field and Description |
---|---|
private Cipher |
dcipher |
private Cipher |
ecipher |
private static String |
HEX |
private int |
iterationCount |
private byte[] |
salt |
Modifier and Type | Method and Description |
---|---|
private static void |
appendHex(StringBuffer sb,
byte b) |
String |
decrypt(String str) |
String |
encrypt(String str) |
static String |
encryptPassword(String password)
Encrypts user password with SHA-512 and encodes it to Base64UrlSafe
|
private static byte[] |
toByte(String hexString) |
private static String |
toHex(byte[] buf) |
private Cipher ecipher
private Cipher dcipher
private final byte[] salt
private final int iterationCount
private static final String HEX
public Crypto(String passPhrase)
private static byte[] toByte(String hexString)
private static String toHex(byte[] buf)
private static void appendHex(StringBuffer sb, byte b)
public static String encryptPassword(String password) throws NoSuchAlgorithmException
password
- Password to be encryptedNoSuchAlgorithmException