You are viewing a plain text version of this content. The canonical link for it is here.
Posted to wss4j-dev@ws.apache.org by bib <bi...@gmail.com> on 2009/05/18 14:00:48 UTC

WSS4J problem Signature+Encryption

Hello,

i have a problem for using action "Signature Encrypt",
i have a service using "Signature Encrypt" action,
but i can call my service with a client using only the Signature action,
the service was executed, it throw an execption but after executing
the service.

so i thinks i have something wrong in the service configuration

for the server side i have:

server wsdd:

      <requestFlow>
          <handler type="soapmonitor"/>
        <handler type="java:org.apache.ws.axis.security.WSDoAllReceiver">
            <parameter name="passwordCallbackClass"
value="fr.lig.adele.action.ServerPWCallback_SignEncrypt"/>
            <parameter name="action" value="Signature Encrypt Timestamp"/>
            <parameter name="decryptionPropFile"
value="server_crypto.properties"/>
            <parameter name="signaturePropFile"
value="server_crypto.properties" />
            <parameter name="user" value="server"/>
            <parameter name="signatureKeyIdentifier"
value="X509KeyIdentifier" />
        </handler>
       
      </requestFlow>
      
      
      <responseFlow>
          <handler type="java:org.apache.ws.axis.security.WSDoAllSender">
              <parameter name="action" value="Encrypt"/>
              <parameter name="encryptionPropFile"
value="server_crypto.properties"/>
              <parameter name="encryptionKeyIdentifier"
value="X509KeyIdentifier"/>
              <parameter name="encryptionUser" value="client"/>
          </handler>
          <handler type="soapmonitor"/>
      </responseFlow>

server callback:

    public void handle(Callback[] callbacks) throws IOException,
            UnsupportedCallbackException {
       
        for(int i = 0 ; i < callbacks.length ; i++) {
            if(callbacks[i] instanceof WSPasswordCallback) {
                WSPasswordCallback pc = (WSPasswordCallback) callbacks[i];
               
                if(pc.getUsage() == WSPasswordCallback.DECRYPT) {
                    if(pc.getIdentifer().equals("server")) {
                        pc.setPassword("serverKeyPass");
                    }
                }
                if(pc.getUsage() == WSPasswordCallback.SIGNATURE) {
                    if(pc.getIdentifer().equals("client")){
                        pc.setPassword("clientKeyPass");
                    }
                }
            } else {
                throw new UnsupportedCallbackException(callbacks[i],
"Unrecognized Callback");
            }
        }

    }

for the client side i have:

client wsdd:

        <requestFlow>
              <handler
type="java:org.apache.ws.axis.security.WSDoAllSender">
                  <parameter name="action" value="Signature Encrypt
Timestamp"/>
                  <parameter name="encryptionUser" value="server"/>
                <parameter name="passwordCallbackClass"
value="xxxx.xxx.xxxx.action.PWCallback_SignEncrypt"/>
                <parameter name="signaturePropFile"
value="crypto.properties" />
                <parameter name="user" value="client"/>
                <parameter name="signatureKeyIdentifier"
value="X509KeyIdentifier" />
              </handler>
        </requestFlow>

        <responseFlow>
            <handler
type="java:org.apache.ws.axis.security.WSDoAllReceiver">
                <parameter name="passwordCallbackClass"
value="xxxx.xxx.xxxx.action.PWCallback_SignEncrypt"/>
                <parameter name="action" value="Encrypt"/>
                <parameter name="decryptionPropFile"
value="crypto.properties"/>
            </handler>
        </responseFlow>

client callback:

    public void handle(Callback[] callbacks) throws IOException,
UnsupportedCallbackException {
        for (int i = 0; i < callbacks.length; i++){
            if (callbacks[i] instanceof WSPasswordCallback){
                WSPasswordCallback pc = (WSPasswordCallback) callbacks[i];
                // set the password given a username
                if ("client".equals(pc.getIdentifer())){
                    pc.setPassword("clientKeyPass");
                }
            }else{
                throw new UnsupportedCallbackException(callbacks[i],
"Unrecognized Callback");
            }
        }
    }


and when i call the service with only signature action client, the service
was executed and after it throw this:

     [echo] Appel du service Web
     [java] Exception in thread "main" AxisFault
     [java]  faultCode:
{http://schemas.xmlsoap.org/soap/envelope/}MustUnderstand
     [java]  faultSubcode:
     [java]  faultString: Did not understand &quot;MustUnderstand&quot;
header(s):{http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd}Security
     [java]  faultActor:
     [java]  faultNode:
     [java]  faultDetail:
     [java]     {http://xml.apache.org/axis/}stackTrace:
     [java]     at
org.apache.axis.handlers.soap.MustUnderstandChecker.invoke(MustUnderstandChecker.java:96)
     [java]     at
org.apache.axis.client.AxisClient.invoke(AxisClient.java:206)
     [java]     at org.apache.axis.client.Call.invokeEngine(Call.java:2784)
     [java]     at org.apache.axis.client.Call.invoke(Call.java:2767)
     [java]     at org.apache.axis.client.Call.invoke(Call.java:2443)
     [java]     at org.apache.axis.client.Call.invoke(Call.java:2366)
     [java]     at org.apache.axis.client.Call.invoke(Call.java:1812)
     [java]     at
xxxx.xxx.xxxx.action.ActionServiceSoapBindingStub.runAction(Unknown Source)
     [java]     at xxxx.xxx.xxxx.action.Client_Sign.main(Unknown Source)
     [java]     {http://xml.apache.org/axis/}hostname:debian
     [java] Did not understand "MustUnderstand"
header(s):{http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd}Security
     [java]     at
org.apache.axis.handlers.soap.MustUnderstandChecker.invoke(MustUnderstandChecker.java:96)
     [java]     at
org.apache.axis.client.AxisClient.invoke(AxisClient.java:206)
     [java]     at org.apache.axis.client.Call.invokeEngine(Call.java:2784)
     [java]     at org.apache.axis.client.Call.invoke(Call.java:2767)
     [java]     at org.apache.axis.client.Call.invoke(Call.java:2443)
     [java]     at org.apache.axis.client.Call.invoke(Call.java:2366)
     [java]     at org.apache.axis.client.Call.invoke(Call.java:1812)
     [java]     at
xxxx.xxx.xxxx.action.ActionServiceSoapBindingStub.runAction(Unknown Source)
     [java]     at xxxx.xxx.xxxx.action.Client_Sign.main(Unknown Source)
     [java] Java Result: 1


thanks
-- 
View this message in context: http://www.nabble.com/WSS4J-problem-Signature%2BEncryption-tp23595858p23595858.html
Sent from the WSS4J mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: wss4j-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: wss4j-dev-help@ws.apache.org