Cob*_*ter 3 powershell certificate x509certificate dsc
升级到 Windows Management Framework 5.0 后,我在获取 DSC 配置时开始收到以下异常。
ConvertTo-MOFInstance : System.ArgumentException error processing property 'Password' OF TYPE 'MSFT_Credential': Certificate
'---HIDDEN-CERTIFICATE-THUMPRINT-VALUE---' cannot be used for encryption. Encryption certificates must contain the Data Encipherment or Key
Encipherment key usage, and include the Document Encryption Enhanced Key Usage (1.3.6.1.4.1.311.80.1).
At C:\Windows\system32\WindowsPowerShell\v1.0\Modules\PSDesiredStateConfiguration\PSDesiredStateConfiguration.psm1:303 char:13
+ ConvertTo-MOFInstance MSFT_Credential $newValue
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [Write-Error], InvalidOperationException
Run Code Online (Sandbox Code Playgroud)
每个节点上使用的证书是使用以下证书请求生成的自签名证书。
[NewRequest]
Subject = CN=[computer-name-here].dsc
KeyLength = 2048
MachineKeySet = true
RequestType = Cert
KeySpec = AT_KEYEXCHANGE
Run Code Online (Sandbox Code Playgroud)
然后将此请求文件馈送到certreq命令行实用程序以生成证书并将其加载到cert:\LocalMachine\My证书存储中。
我已尝试根据certreq 工具的文档将以下内容添加到我的证书请求文件中,但我仍然遇到相同的失败。
KeyUsage = 0x30
[Strings]
szOID_ENHANCED_KEY_USAGE = "1.3.6.1.4.1.311.80.1"
Run Code Online (Sandbox Code Playgroud)
设置KeyUsage为0x30启用密钥加密和数据加密。但是,我似乎无法在生成的证书中找到有关增强密钥用法的详细信息。也许我在请求中错误地设置了这个值。
请帮忙。
小智 5
您也可以使用 New-SelfSignedCertificate cmdlet 生成自签名证书。我编写了这个模块,它将帮助生成 DSC https://github.com/nanalakshmanan/xDSCUtils要求的证书
| 归档时间: |
|
| 查看次数: |
3347 次 |
| 最近记录: |