Ejemplo n.º 1
0
  public static void decrypt(InputStream is, OutputStream os)
      throws IOException, NoSuchPaddingException, NoSuchAlgorithmException, ClassNotFoundException,
          InvalidAlgorithmParameterException, InvalidKeyException {
    SecretKey key = Deserializer.deserializeObject();

    // get Cipher instance and initiate in decrypt mode
    Cipher decryptCipher = Cipher.getInstance("AES");
    decryptCipher.init(Cipher.DECRYPT_MODE, key);

    // create CipherOutputStream to decrypt the data using decryptCipher
    is = new CipherInputStream(is, decryptCipher);
    writeData(is, os);
  }