[Cmdlet] AES256 : File Encrypt & File decrypt

Hi all,

Here are two Cmdlet that you can use to encrypt and decrypt file with AES256.

The encrypt function will first HASH the password with SHA256 to ensure that the password as de correct length (32 bytes)
Then it will generate the IV and open 3 stream (file in, file out & crypto). The 16 bytes of the IV will be written at the beginning of the output file and write the encrypted content starting at the 16th byte.

Here is the Cmdlet with an usage example :

The decrypt function will first HASH the password with SHA256 to ensure that the password has de correct length (32 bytes).
Then it will retreive the IV by reading the 16 first bytes of the input file and open 3 stream (file in, file out & crypto) after that it will read the encrypted content starting at the 16th byte.

Here is the Cmdlet with an usage example :