public static byte[] encryptWithoutBase64(String input, byte[] key) { // to bytes byte[] in = null; try { in = input.getBytes(DEFAULT_CHARSET); } catch (UnsupportedEncodingException e) { Logger.e("failed to get the encrypted info" + e.getMessage()); return null; } // zip byte[] zip = UtilsZip.zip(in); // ecrypt byte[] enc = UtilsCrypto.encrypt(zip, key); // ecode base64 return enc; }
public static String encryptWithBase64NoUrlEncode(String input, byte[] key) { // to bytes byte[] in = null; try { in = input.getBytes(DEFAULT_CHARSET); } catch (UnsupportedEncodingException e) { return null; } // zip byte[] zip = UtilsZip.zip(in); // ecrypt byte[] enc = UtilsCrypto.encrypt(zip, key); // ecode base64 String base64 = null; try { base64 = UtilsBase64.encodeToString(enc); } catch (Exception e) { } return base64; }