Is there a way of using this technique described in to load 2 different
keystores rather than just 1? Construct Properties object in-memory, and
have CXF use that instead.

package soap.common.interceptors;

import client.clientmgr.ClientInfo;
import org.apache.cxf.ws.security.wss4j.WSS4JOutInterceptor;
import org.apache.ws.security.WSSecurityException;
import org.apache.ws.security.components.crypto.Crypto;
import org.apache.ws.security.components.crypto.CryptoFactory;
import org.apache.ws.security.handler.RequestData;

import java.util.Map;
import java.util.Properties;

public class CryptoPropsOutInterceptor extends WSS4JOutInterceptor {

    private ClientInfo clientInfo;

    public CryptoPropsOutInterceptor(Map<String, Object> props, ClientInfo
clientInfo) {
        super(props);
        this.clientInfo = clientInfo;
    }

    @Override
    protected Crypto loadCryptoFromPropertiesFile(String propFilename,
RequestData reqData)
            throws WSSecurityException {

        Properties cxfProps = new Properties();
        cxfProps.setProperty("org.apache.ws.security.crypto.provider",
"org.apache.ws.security.components.crypto.Merlin");
       
cxfProps.setProperty("org.apache.ws.security.crypto.merlin.keystore.type",
"jks");
       
cxfProps.setProperty("org.apache.ws.security.crypto.merlin.keystore.alias",
this.clientInfo.getSignAlias());
       
cxfProps.setProperty("org.apache.ws.security.crypto.merlin.keystore.password",
this.clientInfo.getSignPassword());
       
cxfProps.setProperty("org.apache.ws.security.crypto.merlin.keystore.file",
"client/1080.1/client.jks"); //here this would load only one but i would
like to load 2 if it's possible
// one for signing the other for encrypting. 

        return CryptoFactory.getInstance(cxfProps);

    }

}




--
Sent from: http://cxf.547215.n5.nabble.com/cxf-user-f547216.html

Reply via email to