I have an SQL database that stores my client-side certificate for WCF service and other services. (X509 etc.). I would like to use this Store (instead of βMyβ) to get this certificate (instead of declaring it in web.config), and then use it for WCF.
I tried doing a search on this site and google, but it doesn't seem to help much.
I'm currently doing
var targetEndpoint = new EndpointAddress(targetLogicalAddress, targetIdentity); MyTransportPortTypesClient proxy = new MyTransportPortTypesClient("WebConfigSection", targetEndpoint);
Ideally, I would like to get rid of the "WebConfigSection" and instead pass in some kind of WCF object signed with a certificate.
Does anyone know how to achieve this?
I finally solved it and thatβs how I did it. (I shared my experience so that everyone can use it). This is without using any CertificateStore certificate. Its pure from database to client proxy.
I created an X509Certificate2 object and assigned a physical file (in byte []). You can also put a password if its password is protected.
Then I assigned a certificate to my proxy client. Sort of:
proxy.ClientCredentials.ClientCertificate = __MyCertificate
Now I have manupulated my clientproxy, as I was inteneted in my app.config. what is it. All these properties will be in your proxy object.
Hope this helps.
source share