magicmonty / xmlrpcnet

Mirror from code.google.com/p/xmlrpcnet with additional NuGet Support
2 stars 4 forks source link

'ClientCertificate' policy can be assigned without error, but the Certificate is not included in the request #52

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Using 2.4.0:

========================

TestServer server = (TestServer)XmlRpcProxyGen.Create(typeof(TestServer));

// Ignore problems with Server SSL
System.Net.ServicePointManager.CertificatePolicy = new 
customCertificatePolicy();

// Add client cert (issued by server, valid on server)
server.ClientCertificates.Add(new X509Certificate2Collection(new 
X509Certificate2("C:\\test-cert.pfx", "test")));

try
{
    server.HelloWorld("How are you");
}
catch (XmlRpcServerException e)
{
    Console.WriteLine(e.Message);
}

========================

Against IIS6, with 'Request Client Certificates' checked, results in the 
output:

Forbidden

And the following IIS log entry:

2009-03-13 18:40:34 ############ POST /EndPoint.rem - 443 - ####### XML-
RPC.NET 403 7 5

The HTTP Status translates to: 

HTTP Error 403 - 403.7 Forbidden: Client certificate required

I found the earlier examples of people using ClientCertificate (but not 
using IXmlRpcProxy) where it appeared to be fixed.  Perhaps this is a 
problem with later versions.  I get no errors Adding the ClientCertificate 
(I see from the Source Code for XML-RPC there is no 'sete' for that).

Original issue reported on code.google.com by CodHu...@gmail.com on 13 Mar 2009 at 7:02

GoogleCodeExporter commented 9 years ago
I mean 'set'!

#if (!COMPACT_FRAMEWORK && !SILVERLIGHT)
[Browsable(false)]
public X509CertificateCollection ClientCertificates
{       get { return _clientCertificates; }
}
#endif

Original comment by CodHu...@gmail.com on 13 Mar 2009 at 7:11

GoogleCodeExporter commented 9 years ago
Unable to reproduce. When I run this test code against a server which requires 
client
certificates if I comment out the ClientCertificates.Add line I get an access
forbidden error:

IStateName proxy = XmlRpcProxyGen.Create<IStateName>();
X509Certificate x509 = new X509Certificate(@"c:\temp\xmlrpcs.cer");
proxy.ClientCertificates.Add(x509);
string ret = proxy.GetStateName(1);

Stepping through the code in the debugger I can see the following line being 
executed:

httpReq.ClientCertificates.Add(certificate);

Original comment by ChasC...@gmail.com on 31 Jul 2009 at 11:05