Search code examples
javasecuritycryptographycxfwss4j

Adding multiple alias in crypto.properties in WS security


How do I add multiple alias in crypto.properties file in Apache WSS4J configuration

${PREFIX}.merlin.keystore.alias : The default keystore alias to use, if none is specified. that's all I got from the documentation http://ws.apache.org/wss4j/config.html . Now how do I specify an alias in the same crypto.properties file. I have several certificate in my keystore and I want to specify them in my crypto.properties file.

Thanks in advance.


Solution

  • I don't understand why you want to specify more than one alias in the crypto.properties file. To be more clear, this alias refers to the private key used to encrypt messages sent by the application (or decrypt them), not the certificates/public keys trusted by the application, and it's normal to have only one private key per application.

    The only case that could explain your need is if your application have one certificate + private key per environment, I think. In that case, you can have one crypto.properties file per environment, with only one alias specified in each of them, and the same keystore for all environments, or one crypto.properties with a common alias for all environments, and one keystore per environment.

    I hope my explanation is understandable. Please, don't hesitate to ask me for clarifications if you need or if I misunderstood your intentions ^^.

    Have a good day.


    Edit

    The crypto.properties file concerns only our service, and only our service. It's used to set the certificate and the associated private key needed to encrypt and/or sign messages it sends.

    In order to authenticate the clients signatures, you have to configure a truststore at server-side.

    Maybe the CXF samples projects can help you to configure our own service : http://cxf.apache.org/docs/sample-projects.html. I don't know if you use CXF or another framework, but I think the approach should be very similar.

    I can't be more precise if I don't know which authentication protocol you use in your implementation.