Hi,
I'm puzzeld about your statment:
I didn't know how to configure Merlin jca provider libraries.
Well, Merlin is not a JCA provider. Merlin contains helper and other mehtodes to simplify handling of certificates and other keystore functions. Merlin in turn uses BouncyCastle to access a keystore (BouncyCastle has the keystore primitives).
It may helpful if youn can post some mor info about how you use WSS4J and maybe the code or code snippet so that we can better see what happens.
Regards, Werner
abb x schrieb:
Hello, I am trying use WSS4J for the first time. However, I am stuck at loading correct key store and JCA implementation. I really appreciate your help.
When I use following line to configure and load,
Crypto crypto = CryptoFactory.getInstance("crypto.properties");
crypto.properties file looks like:
org.apache.ws.security.crypto.provider=org.bouncycastle.jce.provider.BouncyCastleProvider org.apache.ws.security.crypto.BouncyCastleProvider.keystore.type=JKS org.apache.ws.security.crypto.BouncyCastleProvider.keystore.password=password org.apache.ws.security.crypto.BouncyCastleProvider.keystore.alias=16c73ab6-b892-458f-abf5-2f875f74882e org.apache.ws.security.crypto.BouncyCastleProvider.alias.password=password org.apache.ws.security.crypto.BouncyCastleProvider.file=C:\security\certificate\test.jks
Trying to find [crypto.properties] using [EMAIL PROTECTED] class loader. java.lang.NoSuchMethodException: org.bouncycastle.jce.provider.BouncyCastleProvider.<init>(java.util.Properties) Using Crypto Engine [org.bouncycastle.jce.provider.BouncyCastleProvider] at java.lang.Class.getConstructor0(Class.java:1937) at java.lang.Class.getConstructor(Class.java:1027) at org.apache.ws.security.components.crypto.CryptoFactory.loadClass(CryptoFactory.java:116) at org.apache.ws.security.components.crypto.CryptoFactory.getInstance(CryptoFactory.java:101) at jca.WSSecurity.encrypt(WSSecurity.java:81) at jca.WSSecurity.main(WSSecurity.java:201) java.lang.ClassCastException 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 jca.WSSecurity.encrypt(WSSecurity.java:81) at jca.WSSecurity.main(WSSecurity.java:201) java.lang.RuntimeException: org.bouncycastle.jce.provider.BouncyCastleProvider 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)Unable to instantiate (1): org.bouncycastle.jce.provider.BouncyCastleProvider java.lang.NoSuchMethodException: org.bouncycastle.jce.provider.BouncyCastleProvider.<init>(java.util.Properties) at java.lang.Class.getConstructor0(Class.java:1937) at java.lang.Class.getConstructor(Class.java:1027) at org.apache.ws.security.components.crypto.CryptoFactory.loadClass(CryptoFactory.java:116) at org.apache.ws.security.components.crypto.CryptoFactory.getInstance(CryptoFactory.java:101) at jca.WSSecurity.encrypt(WSSecurity.java:81) at jca.WSSecurity.main(WSSecurity.java:201) Unable to instantiate (2): org.bouncycastle.jce.provider.BouncyCastleProvider java.lang.ClassCastException 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 jca.WSSecurity.encrypt(WSSecurity.java:81) at jca.WSSecurity.main(WSSecurity.java:201)
at jca.WSSecurity.encrypt(WSSecurity.java:81) at jca.WSSecurity.main(WSSecurity.java:201)
if I use the existing configuration with following 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=password org.apache.ws.security.crypto.merlin.keystore.alias=16c73ab6-b892-458f-abf5-2f875f74882e org.apache.ws.security.crypto.merlin.alias.password=password org.apache.ws.security.crypto.merlin.file=C:\security\certificate\test.jks
I get the following error: Using Crypto Engine [org.apache.ws.security.components.crypto.Merlin] 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 jca.WSSecurity.encrypt(WSSecurity.java:81) at jca.WSSecurity.main(WSSecurity.java:201) Caused by: java.lang.ExceptionInInitializerError at org.apache.ws.security.components.crypto.Merlin.<init>(Merlin.java:108) ... 8 more Caused by: java.lang.RuntimeException: Can't find bundle for base name org.apache.ws.security.components.crypto.errors, locale en_US at org.apache.ws.security.components.crypto.CredentialException.<clinit>(CredentialException.java:43) ... 9 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) Unable to instantiate (1): org.apache.ws.security.components.crypto.Merlin 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 jca.WSSecurity.encrypt(WSSecurity.java:81) at jca.WSSecurity.main(WSSecurity.java:201) Caused by: java.lang.ExceptionInInitializerError at org.apache.ws.security.components.crypto.Merlin.<init>(Merlin.java:108) ... 8 more Caused by: java.lang.RuntimeException: Can't find bundle for base name org.apache.ws.security.components.crypto.errors, locale en_US at org.apache.ws.security.components.crypto.CredentialException.<clinit>(CredentialException.java:43) ... 9 more Unable to instantiate (2): org.apache.ws.security.components.crypto.Merlin 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 jca.WSSecurity.encrypt(WSSecurity.java:81) at jca.WSSecurity.main(WSSecurity.java:201) at org.apache.ws.security.components.crypto.CryptoFactory.getInstance(CryptoFactory.java:101) at jca.WSSecurity.encrypt(WSSecurity.java:81) at jca.WSSecurity.main(WSSecurity.java:201) 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 jca.WSSecurity.encrypt(WSSecurity.java:81) at jca.WSSecurity.main(WSSecurity.java:201)
Ofcourse for the latter case, I didn't know how to configure Merlin jca provider libraries.
Any help is really appreciated.
Thank you.
- Abb
__________________________________ Do you Yahoo!? Yahoo! Mail - 250MB free storage. Do more. Manage less. http://info.mail.yahoo.com/mail_250
