.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

OperationContext is null if client certificate is expired

Posted By:      Posted Date: December 04, 2010    Points: 0   Category :WCF

is there a way to get the details of certificate (cert subject) when service rejects authentication for expired certificate or not trusted.

both the OperationContext and ServiceSecurityContext both are null.



View Complete Post

More Related Resource Links

sslstream client certificate validation error

Hi,I have taken server and client program from MSDN2 for sslstream. in that code client certifiacte authetication is made false  i want to enable that and do the code i have done some modification to the code but is giving error "RemoteCertificateNotAvailable" and i think that its not getting the client certificate at server side.So please can any one help me to do client server program using sslstream in which client certificate also needs to be validated.I am attaching my modified code of MSDN2Server sideusing System;using System.Collections;using System.Net;using System.Net.Sockets;using System.Net.Security;using System.Security.Authentication;using System.Text;using System.Security.Cryptography.X509Certificates;using System.IO;namespace Examples.System.Net{    public sealed class SslTcpServer     {        static X509Certificate serverCertificate = null;        // The certificate parameter specifies the name of the file         // containing the machine certificate.        // The following method is invoked by the RemoteCertificateValidationDelegate.        public static bool ValidateClientCertificate(              object sender,              X509Certificate certificate,              X509Chain chain,              SslPolicyErrors sslPolicyErrors)        {            SslPolicyErrors errors = sslPolicyErrors;            if (errors != SslPolicyErrors.None)            {

connect client certificate to an account in a membership database

Hello I have created a web service that authenticates with username and password, works fine.Basically this one, http://msdn.microsoft.com/en-us/library/ff649647.aspxNow I also want to connect to this web service using client certificates, works finehttp://msdn.microsoft.com/en-us/library/cc948997.aspx But I would like to when authenticated via client certificates, connect that certificate to a user in the membership database.So that I can use Roles.IsUserInRole(...) and such.I thought that, well if I implement a Custom certificate Validatorhttp://msdn.microsoft.com/en-us/library/ms733806.aspxthen I could check for example subject and map that against a created username in the membership database.But in the class X509CertificateValidatorpublic override void Validate(X509Certificate2 certificate)I don't have the same ability as when the user is authenticatedlike  void OnAuthenticateRequest(object source, EventArgs eventArgs)HttpApplication app = (HttpApplication)source;Basically how can I do this app.Context.User = new GenericPrincipal(new GenericIdentity(username, "Membership Provider"),roles);withinpublic override void Validate(X509Certificate2 certificate)and if that is not possible, can this be solved differently?Bottom line, how do I connect a client certificate to a user account in the membership database. Is there a MSDN article

Getting client information from X.509 certificate in C# code

I have a WCF service which accepts X.509 certificate signed incoming messages. As per my understanding the client will send the message with signature encrypted using his private key and web services will decrypt the signature with client's public key. This ensures that the sender of the message is holder of the private key and that he is certified by the server trusted CA as "He is what he claims to be". It's being a highly secure application I need to give access to only certain clients regardless of whether they are trusted or not. (This is to take care of good turned bad scenario :-)) How do I achieve this? Is there any way to get the client information as subject name etc from his certificate in C# code? Is there any example of this usage? Thanks in advance,Jeet.    

C# Client App connecting to WSS3.0 with X.509 certificate

I have been unable to find much information on using smart cards and X.509 certificates when connecting to WSS 3.0.  I am able to build a Web Service Reference in VS 2010 just fine.  I get prompted for my cert, I select it, enter my pin and all is well.  But I am failing to handle it properly in my app.  I created a test method that creates the new WSS List object.  I assign System.Net.Credentials.DefaultCredentials to the Credentials. I then call GetListCollection.  I am never prompted for my cert, and I get a 500 error back from the server.  Everything works fine in IE and adding the reference so I think I missed a step, but I cannot figure out what that would be. I running the app with an account that has no relationship to the authentication domain WSS is part of, so I expected to be prompted for the cert when I tried to connect. Does anyone know how to do this, or offer up some guidance.  Thanks, LD

SharePoint - Report Server - Client Certificate authentication

Hi,I have a SharePoint site collection which requires client certificates. On the server I have configured Reporting Services in integration mode.I can call reports on other site collections which don't require client certificates but not on the site which does. On the site which requires client certificates the pages fail with the following error message:'An unexpected error occurred while connecting to the report server. Verify that the report server is available and configured for SharePoint integrated mode. --> The request failed with HTTP status 403: forbidden'The error message indicates that SharePoint doesn't call the web service with a client certificate. Does anyone know how I can configure SharePoint to use a client certificate?Any help is greatly appreciated.Adam

x509 - Client Certificate infrastructure for Asp.Net question

I dont have a lot of background with SSL and X509 configuration and support with my Asp.Net application, so I was wondering if someone can explain or point me in the right direction to MSDN or any other article or posting explaining if it's possible to do what I am looking to support in my environment.I have IIS 6.0 with SSL (Verisign cert) as well as "Require client certificates" working against a local installation of Microsoft Certificate Services, https://<domain>/certsrv, where users can request and install client certs (both xp clients for basic mode, and Vista/7 for advance mode).Here's what I am up against:I have a segment of users coming from a virtualized server environment where this environment does not store personal settings for more than 48 hours. It's not an internet cafe, but rather an actual business where their IT staff uses server images to reimage each virtual server in the farm every 48hrs. Thus losing all users data in the "Current Users" Certificate Stores.The IT staff give users a network folder share to store any personal items (docs, spreadsheets, links, etc.). The servers consist of Windows Server 2003, and will be migrating to Windows Server 2008 in the next 6-9 months.These users have rights in Internet Explorer to navigate to my certsrv site and use activex to to request and install certificates then clode and

WCF and certificates : "The client certificate is not provided."

Hi,I'm having a hard time to get certificates working with my WCF application and I keep getting the error: "The client certificate is not provided. Specify a client certificate in ClientCredentials."I am using a free trial certificate by Verisign and I have done the following things on a local XP Pro machine:VeriSign Trial Secure Server CA - G2 certificate is installed in the Personal => CerficatesVeriSign Trial Secure Server Root CA - G2 certificate is installed in the Trusted Root Certification Authorities => CertificatesI am using the following kind of binding configuration settings: *** Client web.config ******<binding name="CertificateBinding" maxReceivedMessageSize="4194304">          <security mode="Message">            <message clientCredentialType="Certificate" />          </security>        </binding><endpoint address="http://localhost/MyWcfApplication/Service1.svc"        binding="wsHttpBinding" bindingConfiguration="CertificateBinding"        contract="ServiceReference1.IService1" name=&qu

One-To-One Client Certificate Mapping in Exchange Server 2010 WCF Configuration

Hi.I am having a java client which has proxy classes generated with jax-ws to use the exchange web services (exchange server 2010). This proxy only supports SOAP11.What I need is to configure exchange servers with CAS role to (additionally to the default authentication) map one certificate to one windows accout. Until now I: imported the servers certificate and enabled it (import-ExchangeCertificate -fileData ([Byte[]]$(get-content -path <certpath> -encoding byte -readCount 0)) -password:<security-string pwd> | enable-ExchangeCertificate -services IIS) created a client certificate mapping in IIS 7 and here is where I got stuck What do I have to change in the "...\V14\ClientAccess\exchweb\ews\web.config" to get this scenario work?The web.config file looks like this: <services> <service behaviorConfiguration="EWSServiceBehavior" name="Microsoft.Exchange.Services.Wcf.EWSService"> <endpoint address="" binding="customBinding" bindingConfiguration="EWSHttpsBinding" contract="Microsoft.Exchange.Services.Wcf.IEWSContract"> <endpoint address="wssecurity" binding="customBinding" bindingConfiguration="EWSWSSecurityBinding" contract="Microsoft.Exchange.Services.Wcf.IEWSContract"

Expired Certificate SQL Reporting Services SP2


We recently installed SQL Reporting Services SP2.  When we run Report Manager (i.e http://myserver/reports) and attempt to print a report using the Print control we get UAC prompts for both Vista and Windows 7.  If we click "Show Information About this Publishers Certificate" under UAC prompt it indicates the certificate expired on Feb 22, 2009.  Were the correct CAB files for installing the print control included in SP2?

troubleshooting client certificate authentication issues



i am using self created certs for client authentication. for one of the cert it works fine but ith another cert it does work. i get an error, can't rer connect to server.

is there any way/tool to troubleshoot cert issue?



Receive Client Certificate in Web Service


I'm trying to receive a Client Certificate in a Web Service and having some problems.


Dim cert As X509Certificate = X509Certificate.CreateFromCertFile("C:\cert.cer")
Dim hw As String = _ws.HelloWorld

The certificate seems to be correclty loading and added to the client.

The client connects to the server with HTTPS.


 <WebMethod()> _
    Public Function HelloWorld() As String
        Dim cert As HttpClientCertificate = Me.Context.Request.ClientCertificate
        Return "Hello World"
    End Function

cert.IsPresent is false and all certificate fields are empty.

IIS is configured to Accept Client Certificates.

Reproduced in two environments:

- Windows 7 x64, IIS 7, VS 2008, .NET 3.5

- XP x86, IIS 5, VS 2008, .NET 3.5

Always in the Web Service the Client Certificate is not proesent. I haven't been able to find any other configuration I should do. Can anyone help?



WCF Service to WSE Client - Certificate authentication over SSL

I am trying to access a WCF service with a WSE 3.0 client over SSL using certificate authentication.  I can do it over an unsecured channel using a customBinding on the service side using the MutualCertificate authentication mode and the turnkey policy assertion mutualCertificate11Security on the client side.  This breaks when I move it to a production environment accessible only by SSL and either (1) change nothing in the server config file--connection gets refused because it is not https--or by (2) changing the server custom binding to CertificateOverTransport--client errors with this:  System.InvalidOperationException: Security requirements are not satisfied because the security header is not present in the incoming message.

My question is simply, how do I access a WCF service over SSL using certificate authentication?


how to catch certificate authentication and authorization errors in client


How can i know at client side that my request to wcf service(with certificate authentication over nettcp) has failed because of authentication or authorization.

i think authentication can fail if the certificate is not a valid certificate(ie date has expired). For authorization i have implemented ServcieAuthorizationmanger and returning true/false. how wcf will transfer this to authrization error.



Client proxy - certificate gets loaded after the wcf has been "navigated to" via Internet explorer


We are having issues with our certificates assigned to the WCF-client proxy. If we issue a call to a WCF-service via basicHttpBinding with transport security using certificates we get an error stating "Could not establish secure channel for SSL/TLS with authority X". If we open internet explorer and navigate to the WCF-service and select the certificate, it works nicely and after that our WCF-client proxy works as well.



c# .NET 3.5 Web Service with Client Certificate



I'm creating a Web application to consume a third party Web service. The third party has provided me a Security Certificate and I can use it to see their WSDL in Browser successfully.

I've created a Unit Test to consume the web service with the client certificate and it works fine.

I've also create a Console application to consume the web service, and again it works fine.

The problem is, I created a Web application (ASP .NET in IIS) to consume the web service, and it fails. The party said I didn't send the Client Certificate in the Web Service call. But the code I use is the same as the one running in the Unit Test and Console application.

Background: The Web Application has impersonate="true" and we are using Integrated Windows Authentication. Also we have a Web Proxy in our company to go out to internet.

Below is the code I'm using. I believe the code is fine as it works in some cases except in ASP .NET (IIS). 


this.BuySideService = new FXBuySideServiceV1();

// preserve cookies for auth info (SMSESSION)
this.BuySideService.CookieContainer = new System.Net.CookieContainer();

// basic authentication
this.BuySideService.Credentials = new System.

SharePoint 2010 & Client Certificate Authentication



we have upgraded our WSS 3.2 installation to Sharepoint Foundation 2010 and have trouble with authentication over client certificates (works perfect with WSS 3.2).

You can reproduce this with a fresh install of SharePoint Foundation 2010 on Windows Server 2008 R2. Create an application and set in IIS authentication to Client Certificates. Then create a site with one document library and upload at least two documents. Then check all items in list view and try to delete this documents over delete-button in ribbon (not over context menu). At this point i get a javascript error:

Message: Object expected
Line: 2
Char: 20732
Code: 0
URI: https://XXXX/_layouts/inplview.js?rev=AohvE9XEf%2FI78tuaw1TGAA%3D%3D

I found following HTTP 500 error in IIS-Log:

2010-05-21 13:20:01 POST /_vti_bin/client.svc/ProcessQuery - 443 XXXX\XXX 192.168.XXX.XXX Mozilla/4.0+(compatible;+MSIE+8.0;+Windows+NT+6.1;+WOW64;+Trident/4.0;+SLCC2;+.NET+CLR+2.0.50727;+.NET+CLR+3.5.30729;+.NET+CLR+3.0.30729;+InfoPath.2;+.NET4.0C;+.NET4.0E) 500 0 0 188

If i switch authentication in IIS to Windows Authentication i get no error (HTTP Status Code = 200).

SP2010 SSL Crawl Fails - Accessing this site requires a client certificate.


Full error Message:  Accessing this site requires a client certificate. Specify a client certificate in the crawl rules.

I added the Crawl Rule and Content Source for the test site https://sp.xxxx.com/TestSite and tried specifying each available client certificates in the rules one by one, but the crawl still fails.





What kind of certificate does it needs and how to enable it? I know that the *.xxxx.com certificate is used for our SSL.


ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend