下面有人请帮忙。
尝试使用密钥加密字符串。在生成加密值时,接收以下错误。哪里可以在另一台服务器上做同样的事情而没有任何问题。
在Powershell版本上进行比较,发现两台服务器的版本相同。任何提示?
$Key = (1..16)
$SecureString = ConvertTo-SecureString -String "mypw" -AsPlainText -Force
ConvertFrom-SecureString -SecureString $SecureString -Key $Key
接收以下例外:
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
答案 0 :(得分:0)
FIPS加密算法存在问题。
转到HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Lsa.
并删除子项FipsAlgorithmPolicy
或将子项FipsAlgorithmPolicy
中的DWORD从1更改为0,然后重新启动计算机
此处a link