AES Encryption With PowerShell
Powershell isn’t just for Windows, it can be installed on most operating systems:
It is also well supported with Microsoft Code, such as running on Mac OSX:
With AES encryption we can either use a block cipher of 128 bits for each block, or a stream cipher. ECB, CBC (Cipher Block Chaining) and CFB (Cipher Feedback Block) are block cipher modes, whereas OFB (Output feedback) and CTR (Counter) are stream cipher modes. In the following case we will use a 256-bit encryption key, and with a random salt (IV). The following code is taken from [here]:
With PowerShell, we use the System.Security.Cryptography namespace, and which is defined in the System.Security.Cryptography.Primitives.dll. There are five main cipher modes that we can use with this: