Skip to content

Conversation

@CodyRWhite
Copy link

Updated SHA256 object creation to be FIPS compliant.

When running this script on a FIPS enforced machine the following error occurs

New-Object : Exception calling ".ctor" with "0" argument(s): "This implementation is not part of the Windows Platform FIPS validated cryptographic algorithms."
At C:\ProgramData\CloudLAPS Client\CLAPS_Client.ps1:212 char:50
+ ... 56Managed = New-Object -TypeName "System.Security.Cryptography.SHA256 ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [New-Object], MethodInvocationException
    + FullyQualifiedErrorId : ConstructorInvokedThrowException,Microsoft.PowerShell.Commands.NewObjectCommand

You cannot call a method on a null-valued expression.
At C:\ProgramData\CloudLAPS Client\CLAPS_Client.ps1:221 char:33
+ ...             [byte[]]$ComputedHash = $SHA256Managed.ComputeHash($Encod ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : InvokeMethodOnNull

Exception calling "SignHash" with "3" argument(s): "Value cannot be null.
Parameter name: hash"
At C:\ProgramData\CloudLAPS Client\CLAPS_Client.ps1:224 char:33
+ ...             [byte[]]$SignatureSigned = $RSAPrivateKey.SignHash($Compu ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : ArgumentNullException

Exception calling "ToBase64String" with "1" argument(s): "Value cannot be null.
Parameter name: inArray"
At C:\ProgramData\CloudLAPS Client\CLAPS_Client.ps1:227 char:33
+ ...             $SignatureString = [System.Convert]::ToBase64String($Sign ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : ArgumentNullException

Updated SHA256 object creation to be FIPS compliant.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant