Access client client certificate properties from WCF

I am writing a WCF service where I need to access the Hashcode of the client certificates that are used to connect to the service.

I am looking for a property or method similar to Request.ClientCertificate from ASP.NET 2.0 days, but cannot find anything that makes it easy to access the client certificate.

Our service is configured in such a way that it works with SSL using basicHttpBinding and the security mode "Transport".

IIS is configured to require SSL and Accept certificates.

It should be noted that our server certificate used to protect the endpoint from another CA to a client certificate - client certificates are intended to be checked only using a custom code (in this case, you must obtain the hash code of the connection certificate).

I created a custom implementation of IDispatchMessageInspector to find out if there is access to a client certificate, but to no avail.

Has anyone tried to do this and have been successful before?

+3
source share
2 answers

It seems that the best option for you would be to implement a specialized Certificate Validator for your service. This is basically a class that derives from the X509CertificateValidator and then registered through the configuration file.

, .

+4

, - , , ( basicHttpBinding WCF IIS):

  • IIS HTTPS IIS
  • IIS SSL SSL ( - )
  • WCF basicHttpBinding "" CredentialType ""

, (, - ) " " , IIS.

. , , makecert ; : makecert -n "CN = My Test Auth" -r -cy -a sha1 -sv " .pvk" TestAuth.cer

TestAuth.cer( " " ) " .pvk".

: makecert -a sha1 -n "CN = myConnectionCert" -ic "TestAuth.cer" -iv "My Private Key.pvk" -ss My

myConnectionCert - (, ) IE - , , .

+2

Source: https://habr.com/ru/post/1791982/


All Articles