3

I need to get a list of all the certificates with a particular hash algorithm.

First I tried retrieving SignatureAlgorithm as follows:

Get-ChildItem -Recurse | select thumbprint, subject, SignatureAlgorithm

Which gave me System.Security.Cryptography.Oid as a value of SignatureAlgorithm column

I tried using FriendlyName

Get-ChildItem -Recurse | select thumbprint, subject, SignatureAlgorithm.FriendlyName

But the above returned blank as a value for SignatureAlgorithm

How can I retrieve the readable value of SignatureAlgorithm? And also how do I select all the SHA1 certificates using Powershell?

1 Answer 1

7

Select-Object are expecting names for the properties to show (since you didn't specify a parameter, you're using the 1st pos. which is -Property). There are no properties called SignatureAlgorithm.FriendlyName.

If you use a calculated property, you can design your own property where the value is the property FriendlyName inside the object's SignatureAlgorithm-property. Ex:

Get-ChildItem -Recurse | select thumbprint, subject, @{n="SignatureAlgorithm";e={$_.SignatureAlgorithm.FriendlyName}}

(n is short for name (could also use l or label) and e is short for expression)

Sign up to request clarification or add additional context in comments.

2 Comments

Thanks! How do I do that in where clause to select only those certs that have sha1 algorithm?
Filter on those with a signaturealgorithm-value. .. | where-object { $_.SignatureAlgorithm } | select....

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.