Today,I want to try the Username Authentication with Symmetric Key Sample with Metro.When I use the default keystore and truststore,my service and my client work well.But when I use the keystore and truststore created by keytool,Metro gives me a Exception:
Key used to decrypt EncryptedKey cannot be null
com.sun.xml.wss.impl.WssSoapFaultException: Invalid Security Header
at
com.sun.xml.ws.security.opt.impl.util.SOAPUtil
.newSOAPFaultException(SOAPUtil.java:159)
at
com.sun.xml.ws.security.opt.impl.incoming
.EncryptedKey.getKey(EncryptedKey.java:354)
at
com.sun.xml.ws.security.opt.impl.incoming.KeySelectorImpl
.resolveDirectReference(KeySelectorImpl.java:540)
at
the keytool command used to create the keystore and truststore as follow: (1)keytool -genkeypair -validity 730 -alias myservicekey -keyalg RSA -keystore serviceKeystore.jks -dname "cn=localhost" -keypass xxxxxx -storepass xxxxxx (2)keytool -genkeypair -validity 730 -alias myclientkey -keyalg RSA -keystore clientKeystore.jks -keypass xxxxxx -storepass xxxxxx (3)keytool -export -rfc -keystore serviceKeystore.jks -alias myservicekey -file MyService.cer -storepass xxxxxx (4)keytool -import -noprompt -trustcacerts -file MyService.cer -alias myservicekey -keystore clientKeystore.jks -storepass xxxxxx (5)keytool -export -rfc -keystore clientKeystore.jks -alias myclientkey -file MyClient.cer -storepass xxxxxx (6)keytool -import -noprompt -trustcacerts -file MyClient.cer -alias myclientkey -keystore serviceKeystore.jks -storepass xxxxxx
I find the same problem asked by others http://metro.1045641.n5.nabble.com/Error-when-using-self-signed-certificates-td1067098.html. Now,The Sample still can not work.Is this a Bug of Metro?