J
Josef Brunner
Hi everybody,
my VB.NET (Framework 2.0) client application has to do a HttpWebRequest (for
reading web-pages and downloading files) on a web server. The server uses a
self-signed certifiacte and the client application should also use a
self-signed certificate (of course, signed by the same self-made CA) so we
would have an authentication of both directions: the server to the client
and the other way round.
Is there a way to programmatically load the self-signed server certificate
in my VB application? Something like:
Private _WebClient As HttpWebRequest
Private _ClientCert As X509Certificate2 = LoadCert() ' This already works
_WebClient = CType(WebRequest.Create(_Server + "site.html"), HttpWebRequest)
_WebClient.ClientCertificates.Add(_ClientCert)
' Something like this.....
_WebClient.AuthorizedCertificateAuthorities.Add("MyCA.crt")
Dim NewResponse As HttpWebResponse = CType(_WebClient.GetResponse(),
HttpWebResponse)
So far my client does not accept the server certificate since it could not
establish the trust relationship! Of course, since my client does not know
about the CA. And I don't want to have to install the certificate/CA on each
machine that I need to install the software on.
Any ideas?
Thank you very much,
Josef
my VB.NET (Framework 2.0) client application has to do a HttpWebRequest (for
reading web-pages and downloading files) on a web server. The server uses a
self-signed certifiacte and the client application should also use a
self-signed certificate (of course, signed by the same self-made CA) so we
would have an authentication of both directions: the server to the client
and the other way round.
Is there a way to programmatically load the self-signed server certificate
in my VB application? Something like:
Private _WebClient As HttpWebRequest
Private _ClientCert As X509Certificate2 = LoadCert() ' This already works
_WebClient = CType(WebRequest.Create(_Server + "site.html"), HttpWebRequest)
_WebClient.ClientCertificates.Add(_ClientCert)
' Something like this.....
_WebClient.AuthorizedCertificateAuthorities.Add("MyCA.crt")
Dim NewResponse As HttpWebResponse = CType(_WebClient.GetResponse(),
HttpWebResponse)
So far my client does not accept the server certificate since it could not
establish the trust relationship! Of course, since my client does not know
about the CA. And I don't want to have to install the certificate/CA on each
machine that I need to install the software on.
Any ideas?
Thank you very much,
Josef