Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / New Users / August 2005

Tip: Looking for answers? Try searching our database.

Accepting Certificates

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Ben Phipps - 17 Aug 2005 02:19 GMT
I'm attempting to make a secure connection to wesite using a HttpWebRequest
with a "https:" uri.  However, attempting to get the response fails because
the trust relationship has not been established.  Namely, the issuing
certificate authority is not on the list of trusted authorities.  What I
can't figure out is how to accept the certificate and reissue the request,
even accepting all certificates would be fine as I'm just trying to get this
thing working.  Can anyone out there help me?
Nicole Calinoiu - 19 Aug 2005 16:01 GMT
Permanently accepting a new root CA is a decision that really ought to
involve deliberate human intervention, and I wouldn't recommend that you add
this to your application.  However, if an untrusted root CA should not
prevent the use of https in your application, you may want to consider
creating a custom implementation of the System.Net.ICertificatePolicy
interface for use as the System.Net.ServicePointManager.CertificatePolicy.
(Taken
together, the MSDN topics for the ICertificatePolicy interface and the
CertificatePolicy property form a sample of the technique.)

Even this more limited approach is potentially quite dangerous, and I
wouldn't recommend it, but it does pose less overall risk than blindly
trusting an unknown CA...

> I'm attempting to make a secure connection to wesite using a
> HttpWebRequest
[quoted text clipped - 6 lines]
> this
> thing working.  Can anyone out there help me?
shriop - 22 Aug 2005 06:30 GMT
Create this class

public class TrustedCertificatePolicy : ICertificatePolicy
{
public TrustedCertificatePolicy()
{
}

public bool CheckValidationResult(ServicePoint sp, X509Certificate
certificate, WebRequest request, int problem)
{
return true;
}
}

then somewhere in your calling code, put this

ServicePointManager.CertificatePolicy = new TrustedCertificatePolicy();

Bruce Dunwiddie
http://www.csvreader.com

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.