How to validate a server certificate programmably

S

Silan

When we double click a .cer certificate file, a certificate dialog will be popped up. If the certificate has anything wrong the dialog will show a warning message

Is there a method in the .NET class library which could do such a validation checking and return a boolean
 
H

Harris Reynolds

Have a look at the ICertificatePolicy interface in System.Net. It has one method that allows you to validate or deny a server certificate. A simple implementation would just return..

serverCertificate.Equals( publicKeyCertficate ), where you provide the X509Certifcate of publicKeyCertificate in the constructor ofyour implementaion

You hook this up with the ServicePointManager.CertificatePolicy property in your application

hope this helps

~harri
http://www.harrisreynolds.net/weblog
 
J

Jan Tielens

That's right.

You can also read following post:
http://weblogs.asp.net/jan/archive/2003/12/04/41154.aspx

--
Greetz

Jan Tielens
________________________________
Read my weblog: http://weblogs.asp.net/jan


Harris Reynolds said:
Have a look at the ICertificatePolicy interface in System.Net. It has one
method that allows you to validate or deny a server certificate. A simple
implementation would just return...
serverCertificate.Equals( publicKeyCertficate ), where you provide the
X509Certifcate of publicKeyCertificate in the constructor ofyour
implementaion.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,764
Messages
2,569,566
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top