Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to call a Web service by using a client certificate and service certificate for authentication #6

Closed
Daniyal-Javani opened this issue Dec 16, 2018 · 8 comments

Comments

@Daniyal-Javani
Copy link

Daniyal-Javani commented Dec 16, 2018

I want to convert a code from C# to PHP. In the c# script we have a SOAP client that authenticate with both client certificate and service certificate. The client certificate has a pfx file that contains a .key file and a .cer file. The service certificate is a .cer file. Here it is the App.config file:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
    <startup>
        <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
    </startup>
    <system.serviceModel>
    <behaviors>
        <endpointBehaviors>
        <behavior name="m*****t">
            <clientCredentials>
            <serviceCertificate>
                <authentication certificateValidationMode="None" revocationMode="NoCheck"/>
                <defaultCertificate storeLocation="LocalMachine" storeName="TrustedPeople" x509FindType="FindBySubjectName" findValue="m***.*r"/>
            </serviceCertificate>
            <clientCertificate storeLocation="LocalMachine" storeName="My" x509FindType="FindBySubjectName" findValue="q****b.b****t.*r"/>
            </clientCredentials>
        </behavior>
        </endpointBehaviors>
    </behaviors>
        <bindings>
            <customBinding>
                <binding name="WSHttpBinding_IS***e">
                    <security defaultAlgorithmSuite="Default" authenticationMode="MutualCertificate"
                        requireDerivedKeys="true" includeTimestamp="true" messageProtectionOrder="SignBeforeEncrypt"
                        messageSecurityVersion="WSSecurity11WSTrustFebruary2005WSSecureConversationFebruary2005WSSecurityPolicy11BasicSecurityProfile10"
                        requireSignatureConfirmation="true">
                        <localClientSettings detectReplays="true" />
                        <localServiceSettings detectReplays="true" />
                    </security>
                    <textMessageEncoding />
                    <httpTransport />
                </binding>
            </customBinding>
        </bindings>
        <client>
            <endpoint address="http://q***m.m***b.b***t.*r/e****s/Account/S***e.svc"
                binding="customBinding" bindingConfiguration="WSHttpBinding_IS***e"
                contract="M***b.IS***e" name="WSHttpBinding_IS***e"
                    behaviorConfiguration="m***t">
                <identity>
                <dns value="*.m***b.*r"/>
                </identity>
            </endpoint>
        </client>
    </system.serviceModel>
</configuration>

Can I authenticate to this soap with this repo?

@parsibox
Copy link

hi
how you solved this?
i need it.

@Daniyal-Javani
Copy link
Author

@parsibox
Hey
We couldn't 😄

@mikaelcom
Copy link
Member

@parsibox
Hey
We couldn't

You couldn't due to the native PHP SoapClient or even PHP itself? Or due to using this repo?

@parsibox
Copy link

with both i can not do it

@Daniyal-Javani
Copy link
Author

You couldn't due to the native PHP SoapClient or even PHP itself? Or due to using this repo?

IDK, the API worked fine in C# but we couldn't use it in PHP at all!

@mikaelcom
Copy link
Member

mikaelcom commented Jan 21, 2020

I did not have time to ask at the time you created/closed this issue. If you wish, you can send me the WSDL at contact@mikael-delsol.fr with a sample XML Request, and HTTP Headers if necessary/possible. I'll try to take a look 😉

@Daniyal-Javani
Copy link
Author

@mikaelcom Thank you, I'm not working at the company any more 😉

@parsibox
Copy link

i need it
i try to get xml request sample for you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants