I am trying to install inspec in powershell and during the install I am receiving an error.
Cannot find type [Security.Cryptography.SHA256Cng]: verify that the assembly containing this type is loaded.
The current version of powershell is 7.
The install command being used is.
. { iwr -useb https://omnitruck.chef.io/install.ps1 } | iex; install -project inspec
It installs ok on the windows powershell version 5.1 but it doesn't on the downloaded and installed version of powershell 7.4.1
I have tried hashing something using sha256 and it works ok.
The issue is that
SHA256CngClass only exists .NET Framework and PowerShell 7+ uses .NET, if you wanted to make it work, the function having a reference to that class isGet-SHA256Converterand you could change it to this to make it compatible with both versions: