3

Anyone please help on below.

Trying to encrypt a string using a key. While generating encrypted value, receiving below error. Where as am able to do the same on another server without any issue.

Compared on Powershell version and found both servers have identical versions. Any hints?

$Key = (1..16)
$SecureString = ConvertTo-SecureString -String "mypw" -AsPlainText -Force
ConvertFrom-SecureString -SecureString $SecureString -Key $Key

Receiving Below Exception:

ConvertFrom-SecureString : Exception has been thrown by the target of an invocation.
At line:1 char:1
+ ConvertFrom-SecureString -SecureString $SecureString -Key $Key
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [ConvertFrom-SecureString], TargetInvocationException
    + FullyQualifiedErrorId : System.Reflection.TargetInvocationException,Microsoft.PowerShell.Commands.ConvertFromSec
   ureStringCommand

$error[0].Exception | Format-List * -force

Message        : Exception has been thrown by the target of an invocation.
Data           : {}
InnerException : System.InvalidOperationException: This implementation is not part of the Windows Platform FIPS
                 validated cryptographic algorithms.
                    at System.Security.Cryptography.RijndaelManaged..ctor()
TargetSite     : System.Object InvokeMethod(System.Object, System.Object[], System.Signature, Boolean)
StackTrace     :    at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig,
                 Boolean constructor)
                    at System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags invokeAttr, Binder binder,
                 Object[] parameters, CultureInfo culture)
                    at System.Security.Cryptography.CryptoConfig.CreateFromName(String name, Object[] args)
                    at System.Security.Cryptography.SymmetricAlgorithm.Create(String algName)
                    at Microsoft.PowerShell.SecureStringHelper.Encrypt(SecureString input, Byte[] key, Byte[] iv)
                    at Microsoft.PowerShell.Commands.ConvertFromSecureStringCommand.ProcessRecord()
                    at System.Management.Automation.CommandProcessor.ProcessRecord()
HelpLink       :
Source         : mscorlib
HResult        : -2146232828

1 Answers1

0

FIPS cryptographic algorithms is problem here.

Go to HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Lsa. and delete subkey FipsAlgorithmPolicy or Change DWORD from 1 to 0 for subkey FipsAlgorithmPolicy and restart your computer

Here's a link

Community
  • 1
  • 1