Validate LDAPS

S Abijith 346 Reputation points
2022-09-14T09:23:20.597+00:00

Hi All,
We have a WPF application built on .Net Framework 4.7. This application acts as an LDAPS client by which it authenticates a user against an LDAPS active directory.
We have a requirement to validate the LDAPS x509 v3 certificate before providing access to a user. Can you please let us know the best way to validate the below mentioned parameters:

  • The signature
  • The stored certificates
  • The validity against Certificate Revocation List (CRL)
  • The validity date
  • The IP address checking on Subject Alternative Name

We have attached the code in the question.

We are aware of the 'ServerCertificateValidationCallback' function used for HTTPS certificate validation. We wanted to know if there anything similar in LDAPS or any other better way to validate an LDAPS connection using certificate.

Any suggestion is welcome.
Thank you in advance

240954-ldaps-code.txt

C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,240 questions
0 comments No comments
{count} votes

Accepted answer
  1. Jack J Jun 24,286 Reputation points Microsoft Vendor
    2022-09-15T02:38:18.217+00:00

    @S Abijith , Welcome to Microsoft Q&A, based on my search, you could try to use VerifyServerCertificateCallback to validate the related information about you mentioned.

    Please refer to the code example in the answer to know more about it.

    Hope it could help you.

    Best Regards,
    Jack


    If the answer is the right solution, please click "Accept Answer" and upvote it.If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


0 additional answers

Sort by: Most helpful