使用php中的ws-security x.509证书对SOAP进行身份验证

时间:2018-12-16 14:54:12

标签: php api soap certificate ws-security

我想将C#代码转换为php脚本。这是C#代码的App.config。

<?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***bTest">
            <clientCredentials>
              <clientCertificate storeLocation="LocalMachine" storeName="My" x509FindType="FindBySubjectName" findValue="q***mm***b.bankm***t.ir"/>
            </clientCredentials>
          </behavior>
        </endpointBehaviors>
      </behaviors>
        <bindings>
            <customBinding>
                <binding name="WSHttpBinding_IStatementService">
                    <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.bankm***t.ir/externalServices/Account/StatementService.svc"
                behaviorConfiguration="m***bTest" binding="customBinding"
                bindingConfiguration="WSHttpBinding_IStatementService" contract="ServiceReference1.IStatementService"
                name="WSHttpBinding_IStatementService">
                <identity>
                  <certificate encodedValue="AwAA********dT6gV+Pipw=" />
                </identity>
            </endpoint>
        </client>
    </system.serviceModel>
</configuration>

我尝试了https://github.com/robrichards/wse-php项目,结果是网关超时。反正有

0 个答案:

没有答案