Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/.net/22.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/facebook/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# BTS 2013-邮件具有错误的邮件签名_C#_.net_Wcf_Biztalk_X509certificate - Fatal编程技术网

C# BTS 2013-邮件具有错误的邮件签名

C# BTS 2013-邮件具有错误的邮件签名,c#,.net,wcf,biztalk,x509certificate,C#,.net,Wcf,Biztalk,X509certificate,我发现BizTalk Server 2013和WCF服务存在问题。BizTalk需要使用WCF服务。BizTalk需要使用X509证书对消息进行签名,我收到以下错误消息: There was a failure executing the send pipeline: "BizTalkUtilities.SignPipeline, BizTalkUtilities, Version=1.0.0.0, Culture=neutral, PublicKeyToken=d749e81ab815db5

我发现BizTalk Server 2013和WCF服务存在问题。BizTalk需要使用WCF服务。BizTalk需要使用X509证书对消息进行签名,我收到以下错误消息:

There was a failure executing the send pipeline: "BizTalkUtilities.SignPipeline, 
BizTalkUtilities, Version=1.0.0.0, Culture=neutral, PublicKeyToken=d749e81ab815db56" Source: 
"MIME/SMIME encoder" Send Port: "SndPort_Sign_V2" URI: "http://XXXX/DemoServiceSigned
/DemoService.svc" Reason: The message has a bad message signature.  
首先,我创建了没有安全性的服务,一切正常。一旦我设置了安全性(消息安全性、签名),它就不再工作了。为了确保我的服务很好,我创建了一个测试WCF客户端,它使用具有安全性的服务-没有问题

需要使用X509证书对消息进行签名。所有证书都在正确的位置。我遵循了上面的信息

服务配置:

<bindings>
  <wsHttpBinding>
    <binding name="clientSignConfig">
      <security mode="Message">
        <message clientCredentialType="Certificate"/>
      </security>
    </binding>
  </wsHttpBinding>
</bindings>

<services>
  <service name="SignServiceBL.DemoService" behaviorConfiguration="DemoServiceBehavior">
    <endpoint address=""
              binding="wsHttpBinding"
              bindingConfiguration="clientSignConfig"
              contract="SignServiceBL.IDemoService" />
    <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
  </service>
</services>

<behaviors>
  <serviceBehaviors>
    <behavior name="DemoServiceBehavior">
      <serviceMetadata httpGetEnabled="true"/>
      <serviceDebug includeExceptionDetailInFaults="true"/>
      <serviceCredentials>
        <clientCertificate>
          <authentication certificateValidationMode="PeerTrust" trustedStoreLocation="LocalMachine"/>
        </clientCertificate>
        <serviceCertificate findValue="CN=DemoServiceServerCertificate"/>
      </serviceCredentials>
    </behavior>
  </serviceBehaviors>
</behaviors>

BizTalk Server支持对出站消息进行签名,并支持对入站安全多用途Internet邮件扩展(S/MIME)消息进行签名验证


删除管道后,BizTalk会向服务发送一条消息。现在的问题是它是经过签名和加密的。我正在研究如何让BizTalk只对消息进行签名。如果你有任何想法,请随时发布。如果我找到了,我会把它寄出去;-)

这并不容易,但我能解决我的问题:-)

我写了一篇关于它的文章,因为在这里创建一个答案有点复杂。
看看吧

MIME/SMIME编码器的设置是什么?私钥证书是否在主机实例用户\个人存储中,并在BizTalk Server组级别配置?是的,我遵循了MSDN的完整示例。应该可以。您是否尝试过使用HTTP deb bug工具(如Fiddler)检查BizTalk和测试WCF客户端发送的有效负载?也许你可以找出其中的一些差异并找出问题所在。@你之前的评论:我需要签署WCF消息,而不是电子邮件,因此我不需要MIME/SMIME编码器。我删除了管道,现在BizTalk server对消息进行签名和加密。它应该只对消息进行签名,所以现在我正试图通过使用自定义端点行为和修改客户端代理的protectionlevel来实现这一点。这真的是在BizTalk中对WCF消息进行签名的方法吗?有人问了同样的(未回答的)问题,但使用了动态发送端口
<bindings>
  <customBinding>
    <binding name="demoService_CustomBinding">
      <transactionFlow />
      <security authenticationMode="SecureConversation" messageSecurityVersion="WSSecurity11WSTrustFebruary2005WSSecureConversationFebruary2005WSSecurityPolicy11BasicSecurityProfile10">
        <secureConversationBootstrap authenticationMode="MutualSslNegotiated" messageSecurityVersion="WSSecurity11WSTrustFebruary2005WSSecureConversationFebruary2005WSSecurityPolicy11BasicSecurityProfile10" />
      </security>
      <textMessageEncoding />
      <httpTransport />
    </binding>
  </customBinding>

</bindings>

<behaviors>
  <endpointBehaviors>
    <behavior name="signingBehavior">
      <clientCredentials>
        <clientCertificate findValue="CN=DemoServiceSigning"
                           storeLocation="CurrentUser" storeName="My"/>
        <serviceCertificate>
          <authentication certificateValidationMode="PeerTrust" trustedStoreLocation="LocalMachine"/>
        </serviceCertificate>
      </clientCredentials>
    </behavior>
  </endpointBehaviors>
</behaviors>

<client>
  <endpoint address="http://XXXX/DemoServiceSigned/DemoService.svc"
      binding="customBinding" bindingConfiguration="demoService_CustomBinding" behaviorConfiguration="signingBehavior"
      contract="DemoService.IDemoService" name="WSHttpBinding_IDemoService">
    <identity>
      <dns value="DemoServiceServerCertificate"/>
    </identity>
  </endpoint>
</client>