osman katib
osman katib

Reputation: 135

How can i implement keystore (certificate) soapui in C#?

I have sent a request and got a response from a web service using with SOAPUI

To do this, i added my client certificate to SOAPUI -> Preferences -> SSL Settings

And it worked successfully. (I am getting ssl handshake error if i dont add keystore and password) enter image description here

My problem is that i couldn't implement this (soapui keystore ability) in C# code. Below is my code and the error i get.

enter image description here

Upvotes: 0

Views: 1478

Answers (2)

osman katib
osman katib

Reputation: 135

Finally i figured out the problem.

You should set the clientcertificate while creating the web service instance. By the way, ClientCredentials.ServiceCertificate.SslCertificateAuthentication options are for only ignoring the servercertificate is valid or not.

        X509Certificate2 x509 = Utils.GetZBCertificate();
        ClientCredentials.ServiceCertificate.SslCertificateAuthentication = new System.ServiceModel.Security.X509ServiceCertificateAuthentication();
        ClientCredentials.ServiceCertificate.SslCertificateAuthentication.CertificateValidationMode = System.ServiceModel.Security.X509CertificateValidationMode.None;
        ChannelFactory.Credentials.ClientCertificate.Certificate = x509;

Upvotes: 0

Bilgin Kılıç
Bilgin Kılıç

Reputation: 9119

You can attach your certificates at the endpoint event.

Upvotes: 1

Related Questions