{"action":"created","issue":{"url":"https://api.github.com/repos/dotnet/corefx/issues/9796","repository_url":"https://api.github.com/repos/dotnet/corefx","labels_url":"https://api.github.com/repos/dotnet/corefx/issues/9796/labels{/name}","comments_url":"https://api.github.com/repos/dotnet/corefx/issues/9796/comments","events_url":"https://api.github.com/repos/dotnet/corefx/issues/9796/events","html_url":"https://github.com/dotnet/corefx/issues/9796","id":163436573,"number":9796,"title":"System.Net.Http.WinHttpException (\"The option is invalid\") in System.Net.Http when ClientCertificates are used.","user":{"login":"dperschonok","id":1606157,"avatar_url":"https://avatars.githubusercontent.com/u/1606157?v=3","gravatar_id":"","url":"https://api.github.com/users/dperschonok","html_url":"https://github.com/dperschonok","followers_url":"https://api.github.com/users/dperschonok/followers","following_url":"https://api.github.com/users/dperschonok/following{/other_user}","gists_url":"https://api.github.com/users/dperschonok/gists{/gist_id}","starred_url":"https://api.github.com/users/dperschonok/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dperschonok/subscriptions","organizations_url":"https://api.github.com/users/dperschonok/orgs","repos_url":"https://api.github.com/users/dperschonok/repos","events_url":"https://api.github.com/users/dperschonok/events{/privacy}","received_events_url":"https://api.github.com/users/dperschonok/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/dotnet/corefx/labels/System.Net","name":"System.Net","color":"d4c5f9"}],"state":"open","locked":false,"assignee":{"login":"davidsh","id":7684835,"avatar_url":"https://avatars.githubusercontent.com/u/7684835?v=3","gravatar_id":"","url":"https://api.github.com/users/davidsh","html_url":"https://github.com/davidsh","followers_url":"https://api.github.com/users/davidsh/followers","following_url":"https://api.github.com/users/davidsh/following{/other_user}","gists_url":"https://api.github.com/users/davidsh/gists{/gist_id}","starred_url":"https://api.github.com/users/davidsh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/davidsh/subscriptions","organizations_url":"https://api.github.com/users/davidsh/orgs","repos_url":"https://api.github.com/users/davidsh/repos","events_url":"https://api.github.com/users/davidsh/events{/privacy}","received_events_url":"https://api.github.com/users/davidsh/received_events","type":"User","site_admin":false},"assignees":[{"login":"davidsh","id":7684835,"avatar_url":"https://avatars.githubusercontent.com/u/7684835?v=3","gravatar_id":"","url":"https://api.github.com/users/davidsh","html_url":"https://github.com/davidsh","followers_url":"https://api.github.com/users/davidsh/followers","following_url":"https://api.github.com/users/davidsh/following{/other_user}","gists_url":"https://api.github.com/users/davidsh/gists{/gist_id}","starred_url":"https://api.github.com/users/davidsh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/davidsh/subscriptions","organizations_url":"https://api.github.com/users/davidsh/orgs","repos_url":"https://api.github.com/users/davidsh/repos","events_url":"https://api.github.com/users/davidsh/events{/privacy}","received_events_url":"https://api.github.com/users/davidsh/received_events","type":"User","site_admin":false}],"milestone":null,"comments":3,"created_at":"2016-07-01T17:03:50Z","updated_at":"2016-07-03T00:07:12Z","closed_at":null,"body":"I am trying to call a soap based webservice that requires client certs for authentication and the following exception occurs:\r\n\r\n```\r\nException: Exception thrown: 'System.Net.Http.WinHttpException' in System.Net.Http.dll (\"The option is invalid\"). Exception thrown: 'System.Net.Http.WinHttpException' in System.Net.Http.dll (\"The option is invalid\")\r\n```\r\n\r\nI've tried making these calls using the HttpClientHandler class directly as well as WCF client libraries, and the outcome is the same for both. Here is the code I am using the make these calls. \r\n\r\n```\r\nusing (var httpHandler = new HttpClientHandler())\r\n\t\t\t\t{\r\n\t\t\t\t\tstring certFilePath = @\"C:\\share\\Certificates\\mytestcert.cer\";\r\n\t\t\t\t\tX509Certificate2 cert2 = new X509Certificate2(certFilePath);\r\n\r\n\t\t\t\t\thttpHandler.ClientCertificateOptions = ClientCertificateOption.Manual;\r\n\t\t\t\t\thttpHandler.ClientCertificates.Add(cert2);\r\n\r\n\t\t\t\t\tusing (var client = new HttpClient(httpHandler))\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tclient.DefaultRequestHeaders.Add(\"SOAPAction\", soapAction);\r\n\t\t\t\t\t\tclient.DefaultRequestHeaders.Add(\"Expect\", \"100-continue\");\r\n\t\t\t\t\t\tclient.DefaultRequestHeaders.Add(\"Accept-Encoding\", \"gzip, deflate\");\r\n\t\t\t\t\t\tclient.DefaultRequestHeaders.Add(\"Connection\", \"Keep-Alive\");\r\n\r\n\r\n\t\t\t\t\t\tStringContent stringContent = new StringContent(soapTemplate, null, \"text/xml\");\r\n\r\n\t\t\t\t\t\tusing (HttpResponseMessage response = await client.PostAsync(sUrl, stringContent))\r\n\t\t\t\t\t\tusing (HttpContent content = response.Content)\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tresult = await content.ReadAsStringAsync();\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n```\r\n\r\nIf there is additional information I can provide, please let me know."},"comment":{"url":"https://api.github.com/repos/dotnet/corefx/issues/comments/230128143","html_url":"https://github.com/dotnet/corefx/issues/9796#issuecomment-230128143","issue_url":"https://api.github.com/repos/dotnet/corefx/issues/9796","id":230128143,"user":{"login":"davidsh","id":7684835,"avatar_url":"https://avatars.githubusercontent.com/u/7684835?v=3","gravatar_id":"","url":"https://api.github.com/users/davidsh","html_url":"https://github.com/davidsh","followers_url":"https://api.github.com/users/davidsh/followers","following_url":"https://api.github.com/users/davidsh/following{/other_user}","gists_url":"https://api.github.com/users/davidsh/gists{/gist_id}","starred_url":"https://api.github.com/users/davidsh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/davidsh/subscriptions","organizations_url":"https://api.github.com/users/davidsh/orgs","repos_url":"https://api.github.com/users/davidsh/repos","events_url":"https://api.github.com/users/davidsh/events{/privacy}","received_events_url":"https://api.github.com/users/davidsh/received_events","type":"User","site_admin":false},"created_at":"2016-07-03T00:07:12Z","updated_at":"2016-07-03T00:07:12Z","body":"One thing I noticed about your code:\r\n\r\n```c#\r\nstring certFilePath = @\"C:\\share\\Certificates\\mytestcert.cer\";\r\n                    X509Certificate2 cert2 = new X509Certificate2(certFilePath);\r\n```\r\n\r\nThis code implies that the client certificate contains only the public key portion.  You must only use a client certificate that also includes the private key.  Usually that is only in a PFX type of file. So, you will get an error from trying to use this certificate since it is missing the private key.\r\n\r\nI don't think you should be getting \"Option is invalid\" error though.  That is probably a bug.\r\n\r\nCan you also try a newer version of Windows, i.e. 8 or 10? I would like to see if the error is different."}}
{"actor":{"display_login":"davidsh"}}