Apologize for the "newbie" question here but I'm at a
dead end. I'm trying to run a simple scenario using
WSS4J and Axis using WSDoAll handlers. Have
successfully sent username token via SOAP, now want
to encrypt the token before sending. Here's what I've
done:
1. Create keystore using Sun Java keytool command:
keytool -genkey -keyalg RSA -keystore xes.keystore
-alias xeskey
What is your first and last name?
[Unknown]: Shawn McKinney
What is the name of your organizational unit?
[Unknown]: abc
What is the name of your organization?
[Unknown]: def
What is the name of your City or Locality?
[Unknown]: Xyz
What is the name of your State or Province?
[Unknown]: AX
What is the two-letter country code for this unit?
[Unknown]: US
Is CN=Shawn McKinney, OU=abc, O=def, L=Xyz, ST=ZX,
C=US correct?
[no]: y
Enter key password for <xeskey>
(RETURN if same as keystore password):
2. Copy keystore to
<TomcatHome>/webapps/axis/WEB-INF/classes
3. Create crypto.properties file:
org.apache.ws.security.crypto.provider=org.apache.ws.security.components.crypto.Merlin
org.apache.ws.security.crypto.merlin.keystore.type=jks
org.apache.ws.security.crypto.merlin.keystore.password=changeit
org.apache.ws.security.crypto.merlin.keystore.alias=xeskey
org.apache.ws.security.crypto.merlin.alias.password=changeit
org.apache.ws.security.crypto.merlin.file=xes.keystore
4. Copy crypto.properties file to same place as # 2.
5. Edit client side .wsdl file:
<requestFlow >
<handler
type=
"java:org.apache.ws.axis.security.WSDoAllSender" >
<parameter name="action" value="UsernameToken
Encrypt"/>
<parameter name="passwordCallbackClass"
value="samples.message.PWCallback"/>
<parameter name="passwordType" value="PasswordText"
/>
<parameter name="encryptionPropFile"
value="crypto.properties" />
<parameter name="encryptionKeyIdentifier"
value="X509KeyIdentifier" />
<parameter name="encryptionUser" value="xeskey" />
<parameter name="encryptionParts"
value="{Element}{http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd}UsernameToken"
/>
</handler>
6. Setup corresponding server side instance. Note:
this is not relevant as client side is not working.
7. Invoke the client test, get the following
exception:
java.lang.reflect.InvocationTargetException
at
sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
Method)
at
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at
java.lang.reflect.Constructor.newInstance(Constructor.java:274)
at
org.apache.ws.security.components.crypto.CryptoFactory.loadClass(CryptoFactory.java:117)
at
org.apache.ws.security.components.crypto.CryptoFactory.getInstance(CryptoFactory.java:101)
at
org.apache.ws.axis.security.WSDoAllSender.loadEncryptionCrypto(WSDoAllSender.java:666)
at
org.apache.ws.axis.security.WSDoAllSender.invoke(WSDoAllSender.java:295)
at
org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32)
at
org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118)
at
org.apache.axis.SimpleChain.invoke(SimpleChain.java:83)
at
org.apache.axis.client.AxisClient.invoke(AxisClient.java:127)
at
org.apache.axis.client.Call.invokeEngine(Call.java:2754)
at
org.apache.axis.client.Call.invoke(Call.java:2737)
at
org.apache.axis.client.Call.invoke(Call.java:1773)
at
samples.message.TestMsg.doit(TestMsg.java:125)
at
samples.message.TestMsg.main(TestMsg.java:155)
Caused by:
org.apache.ws.security.components.crypto.CredentialException:
Proxy file (keys/x509.PFX.MSFT) not found.[]
at
org.apache.ws.security.components.crypto.Merlin.<init>(Merlin.java:108)
... 17 more
java.lang.InstantiationException:
org.apache.ws.security.components.crypto.Merlin
at
java.lang.Class.newInstance0(Class.java:293)
at java.lang.Class.newInstance(Class.java:261)
at
org.apache.ws.security.components.crypto.CryptoFactory.loadClass(CryptoFactory.java:125)
at
org.apache.ws.security.components.crypto.CryptoFactory.getInstance(CryptoFactory.java:101)
at
org.apache.ws.axis.security.WSDoAllSender.loadEncryptionCrypto(WSDoAllSender.java:666)
at
org.apache.ws.axis.security.WSDoAllSender.invoke(WSDoAllSender.java:295)
at
org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32)
at
org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118)
at
org.apache.axis.SimpleChain.invoke(SimpleChain.java:83)
at
org.apache.axis.client.AxisClient.invoke(AxisClient.java:127)
at
org.apache.axis.client.Call.invokeEngine(Call.java:2754)
at
org.apache.axis.client.Call.invoke(Call.java:2737)
at
org.apache.axis.client.Call.invoke(Call.java:1773)
at
samples.message.TestMsg.doit(TestMsg.java:125)
at
samples.message.TestMsg.main(TestMsg.java:155)
Exception in thread "main" AxisFault
faultCode:
{http://schemas.xmlsoap.org/soap/envelope/}Server.userException
faultSubcode:
faultString: java.lang.RuntimeException:
org.apache.ws.security.components.crypto.Merlin cannot
create instance
faultActor:
faultNode:
faultDetail:
{http://xml.apache.org/axis/}stackTrace:java.lang.RuntimeException:
org.apache.ws.security.components.crypto.Merlincannot
create instance
at
org.apache.ws.security.components.crypto.CryptoFactory.loadClass(CryptoFactory.java:130)
at
org.apache.ws.security.components.crypto.CryptoFactory.getInstance(CryptoFactory.java:101)
at
org.apache.ws.axis.security.WSDoAllSender.loadEncryptionCrypto(WSDoAllSender.java:666)
at
org.apache.ws.axis.security.WSDoAllSender.invoke(WSDoAllSender.java:295)
at
org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32)
at
org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118)
at
org.apache.axis.SimpleChain.invoke(SimpleChain.java:83)
at
org.apache.axis.client.AxisClient.invoke(AxisClient.java:127)
at
org.apache.axis.client.Call.invokeEngine(Call.java:2754)
at
org.apache.axis.client.Call.invoke(Call.java:2737)
at
org.apache.axis.client.Call.invoke(Call.java:1773)
at
samples.message.TestMsg.doit(TestMsg.java:125)
at
samples.message.TestMsg.main(TestMsg.java:155)
{http://xml.apache.org/axis/}hostname:smckinnhp
java.lang.RuntimeException:
org.apache.ws.security.components.crypto.Merlin cannot
create instance
at
org.apache.axis.AxisFault.makeFault(AxisFault.java:101)
at
org.apache.axis.client.AxisClient.invoke(AxisClient.java:216)
at
org.apache.axis.client.Call.invokeEngine(Call.java:2754)
at
org.apache.axis.client.Call.invoke(Call.java:2737)
at
org.apache.axis.client.Call.invoke(Call.java:1773)
at
samples.message.TestMsg.doit(TestMsg.java:125)
at
samples.message.TestMsg.main(TestMsg.java:155)
Caused by: java.lang.RuntimeException:
org.apache.ws.security.components.crypto.Merlin cannot
create instance
at
org.apache.ws.security.components.crypto.CryptoFactory.loadClass(CryptoFactory.java:130)
at
org.apache.ws.security.components.crypto.CryptoFactory.getInstance(CryptoFactory.java:101)
at
org.apache.ws.axis.security.WSDoAllSender.loadEncryptionCrypto(WSDoAllSender.java:666)
at
org.apache.ws.axis.security.WSDoAllSender.invoke(WSDoAllSender.java:295)
at
org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32)
at
org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118)
at
org.apache.axis.SimpleChain.invoke(SimpleChain.java:83)
at
org.apache.axis.client.AxisClient.invoke(AxisClient.java:127)
Obviously I've misconfigured something here. Just
trying to get a basic example up and running with an
unsigned cert generated with Sun's keytool.
Any input on this is most appreciated.