0
votes

I need to authenticate an endpoint using certificate in WCF Config file I have tried adding with the various authenticationMode setting but its not working in customBinding could you please help me to convert the below code to the custom binding

        <basicHttpBinding>
            <binding name="certBinding">
                <security mode="Message">
                    <message clientCredentialType="Certificate" />
                </security>
            </binding>
        </basicHttpBinding>

This is the code i have tried in custom binding

<customBinding>
        <binding name="OutbBinding1" closeTimeout="00:02:00" openTimeout="00:02:00" receiveTimeout="00:10:00" sendTimeout="00:02:00">
                    <textMessageEncoding maxReadPoolSize="64" maxWritePoolSize="16" messageVersion="Soap11" writeEncoding="utf-8">
                        <readerQuotas maxDepth="32" maxStringContentLength="20000000" maxArrayLength="20000000" maxBytesPerRead="4096" maxNameTableCharCount="16384" />
                    </textMessageEncoding>
            <security authenticationMode="SecureConversation">
            <secureConversationBootstrap authenticationMode="AnonymousForCertificate" />
            </security>
    </binding>
</customBinding>
1

1 Answers

0
votes

As we know, if we use the message security of BasicHttpbinding, we should set up the certificate both in the client and the server. In addition, we should also establish a certificate trust relationship between the server and the client.
One more thing needs to note is, different from the authentication mode of the transport layer security, we need to set a default service certificate (non-client certificate, use the trusted server certificates for signing messages) on the client side.
So anyway, the below configuration could achieve the same goal that authenticates the client with a certificate. please refer to the below configuration.

<customBinding>
    <binding name="TehRealBinding">
        <textMessageEncoding />
        <security authenticationMode="MutualCertificate" />
        <httpTransport />
    </binding>
</customBinding>

Besides, the following document might be useful to you.
https://docs.microsoft.com/en-us/dotnet/framework/wcf/feature-details/securitybindingelement-authentication-modes
Feel free to let me know if there is anything I can help you.