Created
October 31, 2018 15:03
-
-
Save jetrubyshared/fb8e9b0fdab1fce1336f448a36b9c938 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 static String encryptString(String string) { | |
try { | |
if (initKeyStore() && initCipher() && initKey() && initCipherMode(Cipher.ENCRYPT_MODE)) { | |
byte[] bytes = sCipher.doFinal(string.getBytes()); | |
return Base64.encodeToString(bytes, Base64.NO_WRAP); | |
} | |
} catch (IllegalBlockSizeException | BadPaddingException e) { | |
e.printStackTrace(); | |
} | |
return null; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment