support/install_command.ps1 in mixlib-install-3.3.1 vs support/install_command.ps1 in mixlib-install-3.3.2
- old
+ new
@@ -27,15 +27,23 @@
return ([System.BitConverter]::ToString($bytes)).Replace("-", "").ToLower()
} Finally { if (($c -ne $null) -and ($c.GetType().GetMethod("Dispose") -ne $null)) { $c.Dispose() }; if ($in -ne $null) { $in.Dispose() } }
}
function Get-SHA256Converter {
- if($PSVersionTable.PSEdition -eq 'Core') {
- [System.Security.Cryptography.SHA256]::Create()
+ if (Is-FIPS) {
+ New-Object -TypeName Security.Cryptography.SHA256Cng
+ } else {
+ if($PSVersionTable.PSEdition -eq 'Core') {
+ [System.Security.Cryptography.SHA256]::Create()
+ }
+ else {
+ New-Object -TypeName Security.Cryptography.SHA256Managed
+ }
}
- else {
- New-Object -TypeName Security.Cryptography.SHA256Managed
- }
+}
+
+function Is-FIPS {
+ (Get-ItemProperty HKLM:\SYSTEM\CurrentControlSet\Control\Lsa\FipsAlgorithmPolicy).Enabled
}
Function Download-Chef($url, $sha256, $dst) {
Log "Downloading package from $url"
Get-WebContent $url $dst