title: Rampart: siging a soap messages failes with private/key certificate
body: <p>We are running a WSO2 ESB 5.0 server. We want to create a service that transforms a normal SOAP message to a signed version and delivers this to an endpoint. </p>
  
  <p>We are getting the message:</p>
  
  <blockquote>
    <p>Caused by: org.apache.ws.security.WSSecurityException: General
    security error (No certificates for user wso2carbon were found for
    signature)</p>
  </blockquote>
  
  <p>Why do I get this message? I do not understand the meaning of this.</p>
  
  <p><em>Update: I figured out, that the user in the rampart config should be the Alias of the key that you want to use to sign. And the password handler Should return the password of the alias key</em> </p>
  
  <p>The synapse (wso2 esb) service is:</p>
  
  <pre><code>    &lt;?xml version="1.0" encoding="UTF-8"?&gt;
      &lt;proxy xmlns="http://ws.apache.org/ns/synapse"
             name="__mke_siging_out"
             startOnLoad="true"
             statistics="disable"
             trace="disable"
             transports="https"&gt;
         &lt;target&gt;
            &lt;inSequence&gt;
               &lt;send&gt;
                  &lt;endpoint&gt;
                     &lt;address uri="http://foo.bar.host/services/default/Echo/echo_client_ep"&gt;
                        &lt;enableSec policy="gov:/policies/__mke_sign_out.xml"/&gt;
                     &lt;/address&gt;
                  &lt;/endpoint&gt;
               &lt;/send&gt;
            &lt;/inSequence&gt;
            &lt;outSequence&gt;
               &lt;header xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"
                       action="remove"
                       name="wsse:Security"
                       scope="default"/&gt;
               &lt;send/&gt;
            &lt;/outSequence&gt;
            &lt;faultSequence/&gt;
         &lt;/target&gt;
         &lt;description/&gt;
      &lt;/proxy&gt;
  </code></pre>
  
  <p>The rampart configuration is, pointing to a JKS keystore in which private/pub certificate is loaded and protected by a password:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;wsp:Policy xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" wsu:Id="SigOnly"&gt;
      &lt;wsp:ExactlyOne&gt;
          &lt;wsp:All&gt;
              &lt;sp:AsymmetricBinding xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy"&gt;
                  &lt;wsp:Policy&gt;
                      &lt;sp:InitiatorToken&gt;
                          &lt;wsp:Policy&gt;
                              &lt;sp:X509Token sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/AlwaysToRecipient"&gt;
                                  &lt;wsp:Policy&gt;
                                      &lt;sp:RequireThumbprintReference /&gt;
                                      &lt;sp:WssX509V3Token10 /&gt;
                                  &lt;/wsp:Policy&gt;
                              &lt;/sp:X509Token&gt;
                          &lt;/wsp:Policy&gt;
                      &lt;/sp:InitiatorToken&gt;
                      &lt;sp:RecipientToken&gt;
                          &lt;wsp:Policy&gt;
                              &lt;sp:X509Token sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/Never"&gt;
                                  &lt;wsp:Policy&gt;
                                      &lt;sp:RequireThumbprintReference /&gt;
                                      &lt;sp:WssX509V3Token10 /&gt;
                                  &lt;/wsp:Policy&gt;
                              &lt;/sp:X509Token&gt;
                          &lt;/wsp:Policy&gt;
                      &lt;/sp:RecipientToken&gt;
                      &lt;sp:AlgorithmSuite&gt;
                          &lt;wsp:Policy&gt;
                              &lt;sp:Basic256 /&gt;
                          &lt;/wsp:Policy&gt;
                      &lt;/sp:AlgorithmSuite&gt;
                      &lt;sp:Layout&gt;
                          &lt;wsp:Policy&gt;
                              &lt;sp:Strict /&gt;
                          &lt;/wsp:Policy&gt;
                      &lt;/sp:Layout&gt;
                      &lt;sp:IncludeTimestamp /&gt;
                      &lt;sp:OnlySignEntireHeadersAndBody /&gt;
                  &lt;/wsp:Policy&gt;
              &lt;/sp:AsymmetricBinding&gt;
              &lt;sp:Wss10 xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy"&gt;
                  &lt;sp:Policy&gt;
                      &lt;sp:MustSupportRefKeyIdentifier /&gt;
                      &lt;sp:MustSupportRefIssuerSerial /&gt;
                  &lt;/sp:Policy&gt;
              &lt;/sp:Wss10&gt;
              &lt;sp:SignedParts xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy"&gt;
                  &lt;sp:Body /&gt;
              &lt;/sp:SignedParts&gt;
          &lt;/wsp:All&gt;
      &lt;/wsp:ExactlyOne&gt;
      &lt;rampart:RampartConfig xmlns:rampart="http://ws.apache.org/rampart/policy"&gt;
          &lt;rampart:user&gt;wso2carbon&lt;/rampart:user&gt;
          &lt;rampart:passwordCallbackClass&gt;nl.rsg.it.igw.passwordcallback.Handler&lt;/rampart:passwordCallbackClass&gt;
          &lt;rampart:encryptionUser&gt;useReqSigCert&lt;/rampart:encryptionUser&gt;
          &lt;rampart:timestampPrecisionInMilliseconds&gt;true&lt;/rampart:timestampPrecisionInMilliseconds&gt;
          &lt;rampart:timestampTTL&gt;300&lt;/rampart:timestampTTL&gt;
          &lt;rampart:timestampMaxSkew&gt;300&lt;/rampart:timestampMaxSkew&gt;
          &lt;rampart:timestampStrict&gt;false&lt;/rampart:timestampStrict&gt;
          &lt;rampart:tokenStoreClass&gt;org.wso2.carbon.security.util.SecurityTokenStore&lt;/rampart:tokenStoreClass&gt;
          &lt;rampart:nonceLifeTime&gt;300&lt;/rampart:nonceLifeTime&gt;
          &lt;rampart:encryptionCrypto&gt;
              &lt;rampart:crypto provider="org.wso2.carbon.security.util.ServerCrypto" cryptoKey="org.wso2.carbon.security.crypto.privatestore"&gt;
                  &lt;rampart:property name="org.wso2.carbon.security.crypto.alias"&gt;myAlias&lt;/rampart:property&gt;
                  &lt;rampart:property name="org.wso2.carbon.security.crypto.privatestore"&gt;myPrivate.jks&lt;/rampart:property&gt;
                  &lt;rampart:property name="org.wso2.stratos.tenant.id"&gt;-1234&lt;/rampart:property&gt;
                  &lt;rampart:property name="org.wso2.carbon.security.crypto.truststores"&gt;myPrivate.jks&lt;/rampart:property&gt;
              &lt;/rampart:crypto&gt;
          &lt;/rampart:encryptionCrypto&gt;
          &lt;rampart:signatureCrypto&gt;
              &lt;rampart:crypto provider="org.wso2.carbon.security.util.ServerCrypto" cryptoKey="org.wso2.carbon.security.crypto.privatestore"&gt;
                  &lt;rampart:property name="org.wso2.carbon.security.crypto.alias"&gt;myAlias&lt;/rampart:property&gt;
                  &lt;rampart:property name="org.wso2.carbon.security.crypto.privatestore"&gt;myPrivate.jks&lt;/rampart:property&gt;
                  &lt;rampart:property name="org.wso2.stratos.tenant.id"&gt;-1234&lt;/rampart:property&gt;
                  &lt;rampart:property name="org.wso2.carbon.security.crypto.truststores"&gt;myPrivate.jks&lt;/rampart:property&gt;
              &lt;/rampart:crypto&gt;
          &lt;/rampart:signatureCrypto&gt;
      &lt;/rampart:RampartConfig&gt;
  &lt;/wsp:Policy&gt;
  </code></pre>