Created
November 11, 2010 21:37
-
-
Save knitfaced/673243 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private String encryptCredentials(String plaintext) throws Exception { | |
String algorithm = "AES/CBC/PKCS5Padding"; | |
SecretKeySpec skeySpec = new SecretKeySpec(SECRET_KEY.getBytes(), algorithm); | |
Cipher cipher = Cipher.getInstance(algorithm); | |
cipher.init(Cipher.ENCRYPT_MODE, skeySpec); | |
byte[] encrypted = cipher.doFinal(plaintext.getBytes()); | |
return new String(encrypted); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment