Ever,

 

I use something along the lines of the following to accomplish this. I had the same concern with password and have build a custom cipher storage mechanism which is responsible for storing such sensitive data in an encrypted form.

 

        Crypto crypto = null;

 

        Properties cryptoProperties = getJksCryptoProperties(); // Method imp follows

 

        crypto = CryptoFactory.getInstance(cryptoProperties.getProperty("org.apache.ws.security.crypto.provider"), cryptoProperties);

 

 

 

 

    private Properties getCryptoProperties()

    {

 

        Properties cryptoProperties = new Properties();

 

        String keystoreLocationKey = "tsr.services.security.wsshandlerconfig." + configurationDetailsKey + ".keystore.location";

        String keystorePasswordKey = "tsr.services.security.wsshandlerconfig." + configurationDetailsKey + ".keystore.password";

 

        String keystoreLocation = SecurityUtils.getValue(keystoreLocationKey);

        String keystorePassword = SecurityUtils.getValue(keystorePasswordKey);

 

        cryptoProperties.put("org.apache.ws.security.crypto.merlin.file", keystoreLocation);

        cryptoProperties.put("org.apache.ws.security.crypto.merlin.keystore.password", keystorePassword);

 

        cryptoProperties.put("org.apache.ws.security.crypto.provider", "org.apache.ws.security.components.crypto.Merlin");

        cryptoProperties.put("org.apache.ws.security.crypto.merlin.keystore.type", "jks");

 

        return cryptoProperties;

    }

 

 

Hope it helps

 

- Jay

 

 


From: Olano, Ever [mailto:[EMAIL PROTECTED]
Sent: Wednesday, 25 January 2006 6:21 AM
To: [email protected]
Subject: Programmatically set crypto properties?

 

Hello.  I am using WSDoAllSender.  I know that I can programmatically set the user and signature props file using the Stub object.  Can I also programmatically set the Properties passed to the crypto (Merlin) object instead of reading them from the signature props file?  I am particularly interested in getting rid of the entry:

 

org.apache.ws.security.crypto.merlin.keystore.password

 

in the signature props file and moving it into code.

 

Well, actually, I guess I could subclass Merlin and override the constructor to override the password that’s there (if any) with something else.  Is that the only way or is there a “more built-in” way?

 

Thanks,

Ever

Reply via email to