Skip to content

Conversation

@djboris9
Copy link

Hi

This PR implements retrieving a certificate by its SHA1 hash.

It is useful in situations where CertByCommonName cannot determine the correct certificate because there are multiple certificates with the same CN (e.g., one for client auth and one for server auth).

In combination with ListCertificates from #88, users can process each certificate to identify the desired one and obtain the windows.CertContext for a specific certificate.


var certContext *windows.CertContext
var cert *x509.Certificate
for {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't need a for loop for this search as we can ever have just 1 cert with a given SHA.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, you're right. I fixed it now in the recent commit.

Signed-off-by: Boris Djurdjevic <boris@djurdjevic.ch>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants