This file contains 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
// Encrypt where jo is input, and query is output and ENCRPYTION_KEy is key | |
byte[] input = jo.toString().getBytes("utf-8"); | |
MessageDigest md = MessageDigest.getInstance("MD5"); | |
byte[] thedigest = md.digest(ENCRYPTION_KEY.getBytes("UTF-8")); | |
SecretKeySpec skc = new SecretKeySpec(thedigest, "AES/ECB/PKCS5Padding"); | |
Cipher cipher = Cipher.getInstance("AES/ECB/PKCS5Padding"); | |
cipher.init(Cipher.ENCRYPT_MODE, skc); | |
byte[] cipherText = new byte[cipher.getOutputSize(input.length)]; |