Exemple #1
0
  public static String decrypt(String encrypted) {
    try {
      Cipher cipher = Cipher.getInstance("AES");
      cipher.init(Cipher.DECRYPT_MODE, skeySpec);
      byte[] decodedBytes = Base64.decodeToByteArray(encrypted);
      byte[] original = cipher.doFinal(decodedBytes);
      return new String(original);
    } catch (Exception e) {
      e.printStackTrace();
    }

    return null;
  }
Exemple #2
0
  protected Object read(String in) {
    byte[] bytes = Base64.decodeToByteArray(in);
    ByteArrayInputStream bais = new ByteArrayInputStream(bytes);

    return new StreamSource(bais);
  }