title: How to validate soap signature using wss4j library
body: <p>I have a soap message as below</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"&gt;
     &lt;env:Header&gt;
        &lt;wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" env:mustUnderstand="1"&gt;
           &lt;wsse:BinarySecurityToken EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary" ValueType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-x509-token-profile-1.0#X509v3" wsu:Id="X509-3FE116EADE4A5ACE1C14636491396431"&gt;MIIEwjCCBCugAwIBAgIEUZF6sjANBgkqhkiG9w0BAQUFADCBmDEZMBcGA1UEChMQR3J1cG8gVGuYSBTPLrZBFdug27AhMqAzvjmp8G4Aj65E0QKDrnFIU4KTMyhSIFRzL5fATWsohdLXqcebHf+XmlNSQ==&lt;/wsse:BinarySecurityToken&gt;
           &lt;ds:Signature xmlns:ds="http://www.w3.org/2000/09/xmldsig#" Id="SIG-3FE116EADE4A5ACE1C14636491396595"&gt;
              &lt;ds:SignedInfo&gt;
                 &lt;ds:CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#" /&gt;
                 &lt;ds:SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1" /&gt;
                 &lt;ds:Reference URI="#id-3FE116EADE4A5ACE1C14636491396564"&gt;
                    &lt;ds:Transforms&gt;
                       &lt;ds:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#" /&gt;
                    &lt;/ds:Transforms&gt;
                    &lt;ds:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" /&gt;
                    &lt;ds:DigestValue&gt;hsrhNdt06tOUYlbV4gmkEwZEpXg=&lt;/ds:DigestValue&gt;
                 &lt;/ds:Reference&gt;
              &lt;/ds:SignedInfo&gt;
              &lt;ds:SignatureValue&gt;rtBv9+NmGZ58HN1XaWXZDQs2DpoiRCONt3XTM6N/R4SyrVK8ltbZebl0WnBQ==&lt;/ds:SignatureValue&gt;
              &lt;ds:KeyInfo Id="KI-3FE116EADE4A5ACE1C14636491396452"&gt;
                 &lt;wsse:SecurityTokenReference wsu:Id="STR-3FE116EADE4A5ACE1C14636491396483"&gt;
                    &lt;wsse:Reference URI="#X509-3FE116EADE4A5ACE1C14636491396431" ValueType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-x509-token-profile-1.0#X509v3" /&gt;
                 &lt;/wsse:SecurityTokenReference&gt;
              &lt;/ds:KeyInfo&gt;
           &lt;/ds:Signature&gt;
        &lt;/wsse:Security&gt;
        &lt;add:MessageID xmlns:add="http://schemas.xmlsoap.org/ws/2004/08/addressing"&gt;urn:uuid:b43ab47f-8ecb-4ac4-8b36-ee3649a734bf&lt;/add:MessageID&gt;
     &lt;/env:Header&gt;
     &lt;env:Body xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" wsu:Id="id-3FE116EADE4A5ACE1C14636491396564"&gt;
        &lt;request&gt;
           &lt;param1&gt;234&lt;/param1&gt;
           &lt;param2&gt;sdf2342&lt;/param2&gt;
        &lt;/request&gt;
     &lt;/env:Body&gt;
  &lt;/env:Envelope&gt;
  </code></pre>
  
  <p>How can I verify the message signature using <strong>wss4j</strong>.? I want to do it in a java program and not in any framework like <strong>axis</strong> or <strong>cxf</strong>.</p>