Beispiel #1
0
  public byte[] decrypt(final String str) {
    try {
      // Decode base64 to get bytes
      byte[] dec = Base64.decode(str);

      return this.decrypt(dec);
    } catch (Throwable t) {
    }
    return null;
  }
Beispiel #2
0
  public String encrypt(byte[] data) {
    try {
      // Encrypt
      byte[] enc = _ecipher.doFinal(data);

      // Encode bytes to base64 to get a string
      return Base64.encodeBytes(enc);
    } catch (Throwable t) {
    }
    return null;
  }