title: Outgoing Soap Request not signed
body: <p>My outgoing soap is not signed. 
  Here is how the outgoing soap should look like</p>
  
  <pre><code>        &lt;xenc:EncryptedKey xmlns:xenc="http://www.w3.org/2001/04/xmlenc#"&gt;
          &lt;xenc:EncryptionMethod Algorithm="http://www.w3.org/2001/04/xmlenc#rsa-1_5"/&gt;
          &lt;KeyInfo xmlns="http://www.w3.org/2000/09/xmldsig#"&gt;
          &lt;wsse:SecurityTokenReference&gt;
          &lt;wsse:Reference URI="#SecurityToken-c0cc2cd4-cb77-4fa5-abfa-bd485afd1685" ValueType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-x509-token-profile-1.0#X509v3"/&gt;
          &lt;/wsse:SecurityTokenReference&gt;
          &lt;/KeyInfo&gt;
          &lt;xenc:CipherData&gt;
          &lt;xenc:CipherValue&gt;gpBAWt91pdwhKva............&lt;/xenc:CipherValue&gt;
          &lt;/xenc:CipherData&gt;
          &lt;xenc:ReferenceList&gt;
          &lt;xenc:DataReference URI="#Enc-0641b860-b16d-4941-91c0-d60bece67794"/&gt;
          &lt;/xenc:ReferenceList&gt;
          &lt;/xenc:EncryptedKey&gt;
          &lt;Signature xmlns="http://www.w3.org/2000/09/xmldsig#"&gt;
          &lt;SignedInfo&gt;
       &lt;ds:CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#" xmlns:ds="http://www.w3.org/2000/09/xmldsig#"/&gt;
          &lt;SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"/&gt;
          &lt;Reference URI="#Id-f10674fd-b999-47c9-9568-c11fa5e5405b"&gt;
          &lt;Transforms&gt;
          &lt;Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/&gt;
          &lt;/Transforms&gt;
          &lt;DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/&gt;
          &lt;DigestValue&gt;wRUq.........&lt;/DigestValue&gt;
          &lt;/Reference&gt;
          &lt;/SignedInfo&gt;
          &lt;SignatureValue&gt;tBSsaZi........&lt;/SignatureValue&gt;
          &lt;KeyInfo&gt;
          &lt;wsse:SecurityTokenReference&gt;
          &lt;wsse:Reference URI="#SecurityToken-e00c8062-83d2-4f04-88fc-996218e7bb3d" ValueType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-x509-token-profile-1.0#X509v3"/&gt;
          &lt;/wsse:SecurityTokenReference&gt;
          &lt;/KeyInfo&gt;
          &lt;/Signature&gt;
          &lt;/wsse:Security&gt;
          &lt;/soapenv:Header&gt;
          &lt;soapenv:Body wsu:Id="Id-f10674fd-b999-47c9-9568-c11fa5e5405b" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"&gt;
          &lt;xenc:EncryptedData Id="Enc-0641b860-b16d-4941-91c0-d60bece67794" Type="http://www.w3.org/2001/04/xmlenc#Content" xmlns:xenc="http://www.w3.org/2001/04/xmlenc#"&gt;
          &lt;xenc:EncryptionMethod Algorithm="http://www.w3.org/2001/04/xmlenc#tripledes-cbc"/&gt;
          &lt;xenc:CipherData&gt;
          &lt;xenc:CipherValue&gt;SQsTCAK6ZaVhojB8+Y.........&lt;/xenc:CipherValue&gt;
          &lt;/xenc:CipherData&gt;
          &lt;/xenc:EncryptedData&gt;
          &lt;/soapenv:Body&gt;
          &lt;/soapenv:Envelope&gt;
  
  This request uses the public key to encrypt 
  1) Signature reference URI &lt;Signature xmlns="http://www.w3.org/2000/09/xmldsig#"&gt;
          &lt;SignedInfo&gt;
       &lt;ds:CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#" xmlns:ds="http://www.w3.org/2000/09/xmldsig#"/&gt;
          &lt;SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"/&gt;
          &lt;Reference URI="#Id-f10674fd-b999-47c9-9568-c11fa5e5405b"&gt;
  This Reference URI is referenced in the Body wsu:Id="Id-f10674fd-b999-47c9-9568-c11fa5e5405b
  
  2)   &lt;xenc:CipherData&gt;
          &lt;xenc:CipherValue&gt;gpBAWt91pdwhKva............&lt;/xenc:CipherValue&gt;
          &lt;/xenc:CipherData&gt;
          &lt;xenc:ReferenceList&gt;
          &lt;xenc:DataReference URI="#Enc-0641b860-b16d-4941-91c0-d60bece67794"/&gt;
          &lt;/xenc:ReferenceList&gt;
  This Enc is also referenced in the Body &lt;xenc:EncryptedData Id="Enc-0641b860-b16d-4941-91c0-d60bece67794" 
  </code></pre>
  
  <p>This is my custom binding </p>
  
  <pre><code> private CustomBinding PeerCustomBinding()
          {
              AsymmetricSecurityBindingElement secBE = AsymmetricSecurityBindingElement.CreateMutualCertificateDuplexBindingElement();
              secBE.AllowSerializedSigningTokenOnReply = false;
              secBE.RequireSignatureConfirmation = false;
              secBE.DefaultAlgorithmSuite = SecurityAlgorithmSuite.TripleDesRsa15;
             secBE.MessageSecurityVersion = MessageSecurityVersion.WSSecurity11WSTrustFebruary2005WSSecureConversationFebruary2005WSSecurityPolicy11BasicSecurityProfile10;
             X509SecurityTokenParameters x509ProtectionParameters = new X509SecurityTokenParameters();
             x509ProtectionParameters.RequireDerivedKeys = false;
             x509ProtectionParameters.X509ReferenceStyle = X509KeyIdentifierClauseType.SubjectKeyIdentifier;
             x509ProtectionParameters.ReferenceStyle = SecurityTokenReferenceStyle.Internal;
             x509ProtectionParameters.InclusionMode = SecurityTokenInclusionMode.AlwaysToRecipient;
             secBE.InitiatorTokenParameters = x509ProtectionParameters;
             secBE.RecipientTokenParameters = x509ProtectionParameters;
           //  secBE.EndpointSupportingTokenParameters.Signed.Add(new UserNameSecurityTokenParameters());
             CustomTextMessageBindingElement enc = new CustomTextMessageBindingElement();
             //TextMessageEncodingBindingElement enc = new TextMessageEncodingBindingElement(MessageVersion.Soap11, Encoding.UTF8);
              HttpsTransportBindingElement b = new HttpsTransportBindingElement();
              CustomBinding be = new CustomBinding();
              be.Elements.Add(secBE);
              be.Elements.Add(enc);
              be.Elements.Add(b);
              return be;
  
  
          }
  </code></pre>
  
  <p>This is the soap generated. Obviously I don't see a signature node. Also, the Id's referenced in the body have no References. </p>
  
  <pre><code>  &lt;e:EncryptedKey Id="_0" xmlns:e="http://www.w3.org/2001/04/xmlenc#"&gt;
          &lt;e:EncryptionMethod Algorithm="http://www.w3.org/2001/04/xmlenc#rsa-1_5" /&gt;
          &lt;KeyInfo xmlns="http://www.w3.org/2000/09/xmldsig#"&gt;
            &lt;o:SecurityTokenReference&gt;
              &lt;o:Reference ValueType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-x509-token-profile-1.0#X509v3" URI="#uuid-711565ff-cd32-4e10-af6d-f84d34b6cb5f-1" /&gt;
            &lt;/o:SecurityTokenReference&gt;
          &lt;/KeyInfo&gt;
          &lt;e:CipherData&gt;
            &lt;e:CipherValue&gt;V+tlheG3BuP8JVPXmz98T0O9dnT5z57U0TqTuPQmb82WiKKDFFDKsGQv/5+lyD5ISRUEr0zlEPRUFCS5ggtSnDWCtOvTcrPMwLNRuz6g7qS/Yx3VFu+h2rfvy2a/LinC7lhmDW0TO6xVoxQCZdLx/rZMh9K5si8JPCelXloZmaA=&lt;/e:CipherValue&gt;
          &lt;/e:CipherData&gt;
          &lt;e:ReferenceList&gt;
            &lt;e:DataReference URI="#_2" /&gt;
            &lt;e:DataReference URI="#_7" /&gt;
          &lt;/e:ReferenceList&gt;
        &lt;/e:EncryptedKey&gt;
        &lt;e:EncryptedData Id="_7" Type="http://www.w3.org/2001/04/xmlenc#Element" xmlns:e="http://www.w3.org/2001/04/xmlenc#"&gt;
          &lt;e:EncryptionMethod Algorithm="http://www.w3.org/2001/04/xmlenc#tripledes-cbc" /&gt;
          &lt;e:CipherData&gt;
            &lt;e:CipherValue&gt;4=&lt;/e:CipherValue&gt;
          &lt;/e:CipherData&gt;
        &lt;/e:EncryptedData&gt;
      &lt;/o:Security&gt;
    &lt;/s:Header&gt;
    &lt;s:Body u:Id="_1" xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:u="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"&gt;
      &lt;e:EncryptedData Id="_2" Type="http://www.w3.org/2001/04/xmlenc#Content" xmlns:e="http://www.w3.org/2001/04/xmlenc#"&gt;
        &lt;e:EncryptionMethod Algorithm="http://www.w3.org/2001/04/xmlenc#tripledes-cbc" /&gt;
        &lt;e:CipherData&gt;
          &lt;e:CipherValue&gt;Removed&lt;/e:CipherValue&gt;
        &lt;/e:CipherData&gt;
      &lt;/e:EncryptedData&gt;
    &lt;/s:Body&gt;
  &lt;/s:Envelope&gt;
  </code></pre>
  
  <p>Please suggest Thank you</p>