Cod*_*ess 1 algorithm powershell sha1
我需要获得具有特定哈希算法的所有证书的列表.
首先,我尝试检索SignatureAlgorithm,如下所示:
Get-ChildItem -Recurse | select thumbprint, subject, SignatureAlgorithm
Run Code Online (Sandbox Code Playgroud)
这给了我System.Security.Cryptography.Oid作为SignatureAlgorithm专栏的价值
我尝试使用FriendlyName
Get-ChildItem -Recurse | select thumbprint, subject, SignatureAlgorithm.FriendlyName
Run Code Online (Sandbox Code Playgroud)
但上面的返回空白作为值 SignatureAlgorithm
如何检索可读值SignatureAlgorithm?还有我如何选择SHA1使用所有证书Powershell?
Select-Object期待要显示的属性的名称(因为您没有指定参数,所以您使用的是第一个pos.这是-Property).没有叫做的属性SignatureAlgorithm.FriendlyName.
如果使用计算属性,则可以设计自己的属性,其中值是FriendlyName对象的SignatureAlgorithm-property中的属性.例如:
Get-ChildItem -Recurse | select thumbprint, subject, @{n="SignatureAlgorithm";e={$_.SignatureAlgorithm.FriendlyName}}
Run Code Online (Sandbox Code Playgroud)
(n缩写name(也可以使用l or label)并且e是简称expression)