public static String encryptWithKeyBase64(String data, String key) { try { byte[] valueByte = encrypt( data.getBytes(ConfigureEncryptAndDecrypt.CHAR_ENCODING), Base64.decode(key.getBytes())); return new String(Base64.encode(valueByte)); } catch (UnsupportedEncodingException e) { throw new RuntimeException("encrypt fail!", e); } }
public static String genarateRandomKeyWithBase64() { return new String(Base64.encode(genarateRandomKey())); }