I didn't have org.apache.ws.security.components.crypto.BouncyCastle, so I got the latest from http://svn.apache.org/repos/asf/webservices/wss4j/trunk/.

I removed the wss4j.jar from my project and just added the whole trunk.  Then I changed the crypto.properties first line to:
org.apache.ws.security.crypto.provider=org.apache.ws.security.components.crypto.BouncyCastle

As for the appropriate BC jar file, I am using the one in the WSS4J trunk (lib/bcprov-jdk13-129.jar).  Shouldn't that be the right one?

None of the tests that have to do with wss4j.keystore/crypto.properties are passing under JDK 1.3, 1.4.2, or 1.5.  The all give the same java.lang.NoSuchMethodException errors like this:

- The provider BC had to be added to the java.security.Security
- Trying to find [crypto.properties] using [EMAIL PROTECTED] class loader.
- Using Crypto Engine [org.apache.ws.security.components.crypto.BouncyCastle]
java.lang.NoSuchMethodException: org.apache.ws.security.components.crypto.BouncyCastle.<init>(java.util.Properties, java.lang.ClassLoader)
        at java.lang.Class.getConstructor0(Class.java:2647)
        at java.lang.Class.getConstructor(Class.java:1629)
        at org.apache.ws.security.components.crypto.CryptoFactory.loadClass(CryptoFactory.java:141)
        at org.apache.ws.security.components.crypto.CryptoFactory.loadClass(CryptoFactory.java:119)
        at org.apache.ws.security.components.crypto.CryptoFactory.getInstance(CryptoFactory.java:101)- Unable to instantiate (1): org.apache.ws.security.components.crypto.BouncyCastle
java.lang.NoSuchMethodException: org.apache.ws.security.components.crypto.BouncyCastle.<init>(java.util.Properties, java.lang.ClassLoader)
        at java.lang.Class.getConstructor0(Class.java:2647)
        at java.lang.Class.getConstructor(Class.java:1629)
        at org.apache.ws.security.components.crypto.CryptoFactory.loadClass(CryptoFactory.java:141)
        at org.apache.ws.security.components.crypto.CryptoFactory.loadClass(CryptoFactory.java:119)
        at org.apache.ws.security.components.crypto.CryptoFactory.getInstance(CryptoFactory.java:101)
        at org.apache.ws.security.components.crypto.CryptoFactory.getInstance(CryptoFactory.java:54)
        at wssec.CopyOfTestWSSecurity.<clinit>(CopyOfTestWSSecurity.java:54)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:585)
        at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.getTest(RemoteTestRunner.java:403)
        at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:445)
        at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:344)
        at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)

        at org.apache.ws.security.components.crypto.CryptoFactory.getInstance(CryptoFactory.java:54)
        at wssec.CopyOfTestWSSecurity.<clinit>(CopyOfTestWSSecurity.java:54)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:585)
        at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.getTest(RemoteTestRunner.java:403)
        at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:445)
        at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:344)
        at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
java.lang.InstantiationException: org.apache.ws.security.components.crypto.BouncyCastle
        at java.lang.Class.newInstance0(Class.java:335)
        at java.lang.Class.newInstance(Class.java:303)
        at org.apache.ws.security.components.crypto.CryptoFactory.loadClass(CryptoFactory.java:150)- Unable to instantiate (2): org.apache.ws.security.components.crypto.BouncyCastle
java.lang.InstantiationException: org.apache.ws.security.components.crypto.BouncyCastle
        at java.lang.Class.newInstance0(Class.java:335)
        at java.lang.Class.newInstance(Class.java:303)
        at org.apache.ws.security.components.crypto.CryptoFactory.loadClass(CryptoFactory.java:150)
        at org.apache.ws.security.components.crypto.CryptoFactory.loadClass(CryptoFactory.java:119)
        at org.apache.ws.security.components.crypto.CryptoFactory.getInstance(CryptoFactory.java:101)
        at org.apache.ws.security.components.crypto.CryptoFactory.getInstance(CryptoFactory.java:54)
        at wssec.CopyOfTestWSSecurity.<clinit>(CopyOfTestWSSecurity.java:54)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:585)
        at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.getTest(RemoteTestRunner.java:403)
        at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:445)
        at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:344)
        at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)

        at org.apache.ws.security.components.crypto.CryptoFactory.loadClass(CryptoFactory.java:119)
        at org.apache.ws.security.components.crypto.CryptoFactory.getInstance(CryptoFactory.java:101)
        at org.apache.ws.security.components.crypto.CryptoFactory.getInstance(CryptoFactory.java:54)
        at wssec.CopyOfTestWSSecurity.<clinit>(CopyOfTestWSSecurity.java:54)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:585)
        at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.getTest(RemoteTestRunner.java:403)
        at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:445)
        at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:344)
        at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
Exception in thread "main" java.lang.ExceptionInInitializerError
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:585)
        at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.getTest(RemoteTestRunner.java:403)
        at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:445)
        at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:344)
        at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
Caused by: java.lang.RuntimeException: org.apache.ws.security.components.crypto.BouncyCastle cannot create instance
        at org.apache.ws.security.components.crypto.CryptoFactory.loadClass(CryptoFactory.java:155)
        at org.apache.ws.security.components.crypto.CryptoFactory.loadClass(CryptoFactory.java:119)
        at org.apache.ws.security.components.crypto.CryptoFactory.getInstance(CryptoFactory.java:101)
        at org.apache.ws.security.components.crypto.CryptoFactory.getInstance(CryptoFactory.java:54)
        at wssec.CopyOfTestWSSecurity.<clinit>(CopyOfTestWSSecurity.java:54)
        ... 8 more




Werner Dittmann <[EMAIL PROTECTED]>

02/03/2006 02:17 PM

To
[EMAIL PROTECTED]
cc
[email protected]
Subject
Re: How to use with JDK 1.3





The definition of the WSS4J crypto provider is wrong. This is _not_ the
JCE crypto provider but the WSS4J crypto provider that handles
all keystore and certificate stuff for WSS4J.

You shall use
org.apache.ws.security.components.crypto.Merlin
or
org.apache.ws.security.components.crypto.BouncyCastle
instead of the class you defined in the properties file.

Both classes are implementations of the WSS4J crypto API but
using and supporting different JDK versions.

AFAIK the Merlin provider works for JDK 1.4 and up and
the above named BouncyCastle provider works with JDK 1.3.
However you may try both to see which implementation of the
WSS4J crypto API works best for you.

Also make sure that you have the appropriate BC jar file
in your classpath that contains the full BC JCE implementation
if you use the org.apache.ws.security.components.crypto.BouncyCastle
class.

Regards,
Werner


[EMAIL PROTECTED] wrote:
>
> I am having trouble using WSS4J with my IBM JDK 1.3.1.  Is this
> possible?  If so, how?
>
> I have tried lots of things, and sent code/errors in email yesterday
> with no response.  In other technology forums, where I am much more
> knowledgable, I have helped lots of people.  Please someone here take
> the time to help me ;-)  Werner???  Dims???  Anybody???
>
> I looked through the src and couldn't find any tests or examples.  I
> have searched Google and all I find is a post from Dims that he got it
> working without much detail.  I have WSS4j 1.1.0, so do I need newer?
>
> Can somebody please point me to some helpful information regarding how
> to use WSS4J with a 1.3 JDK?  I have been trying with
> org.bouncycastle.jce.provider.BouncyCastleProvider specified in my
> crypto.properties.  This fails in the CryptoFactory.loadClass()
> cryptogenClass.getConstructor(classes) on line 116.
>
> Basically, when I run Crypto crypto =
> CryptoFactory.getInstance("bc-crypto.properties"); with the properties
> file below (or null) I get errors.
>
> org.apache.ws.security.crypto.provider=org.bouncycastle.jce.provider.BouncyCastleProvider
>
> org.apache.ws.security.crypto.merlin.keystore.type=jks
> org.apache.ws.security.crypto.merlin.keystore.password=xxxxx
> org.apache.ws.security.crypto.merlin.keystore.alias=mcmclient
> org.apache.ws.security.crypto.merlin.alias.password=xxxxx
> org.apache.ws.security.crypto.merlin.file=C:/Program
> Files/Lotus/notes/jvm/lib/security/test.keystore
>
> - Using Crypto Engine [org.bouncycastle.jce.provider.BouncyCastleProvider]
> - Unable to instantiate (1):
> org.bouncycastle.jce.provider.BouncyCastleProvider
> _java.lang.NoSuchMethodException_: <init>
>         at java.lang.Class.getConstructor0(_Native Method_)
>         at java.lang.Class.getConstructor(_Class.java:967_)
>         at
> org.apache.ws.security.components.crypto.CryptoFactory.loadClass(_CryptoFactory.java:118_)
>
>         at
> org.apache.ws.security.components.crypto.CryptoFactory.getInstance(_CryptoFactory.java:101_)
>
>         at
> ca.on.gov.jus.justiceconnect.CriminalInvestigationsServiceSoapStub.createCall(_CriminalInvestigationsServiceSoapStub.java:131_)
>
>         at
> ca.on.gov.jus.justiceconnect.CriminalInvestigationsServiceSoapStub.submitMajorCaseInvestigation(_CriminalInvestigationsServiceSoapStub.java:151_)
>
>         at
> ca.on.gov.jus.justiceconnect.CriminalInvestigationsAgentHelper.NotesMainHelper(_CriminalInvestigationsAgentHelper.java:165_)
>
>         at
> CriminalInvestigationsAgent.NotesMain(_CriminalInvestigationsAgent.java:74_)
>
>         at
> CriminalInvestigationsAgent.main(_CriminalInvestigationsAgent.java:48_)
> - Unable to instantiate (2):
> org.bouncycastle.jce.provider.BouncyCastleProvider
> _java.lang.ClassCastException_:
> org.bouncycastle.jce.provider.BouncyCastleProvider
>         at
> org.apache.ws.security.components.crypto.CryptoFactory.loadClass(_CryptoFactory.java:127_)
>
>         at
> org.apache.ws.security.components.crypto.CryptoFactory.getInstance(_CryptoFactory.java:101_)
>
>         at
> ca.on.gov.jus.justiceconnect.CriminalInvestigationsServiceSoapStub.createCall(_CriminalInvestigationsServiceSoapStub.java:131_)
>
>         at
> ca.on.gov.jus.justiceconnect.CriminalInvestigationsServiceSoapStub.submitMajorCaseInvestigation(_CriminalInvestigationsServiceSoapStub.java:151_)
>
>         at
> ca.on.gov.jus.justiceconnect.CriminalInvestigationsAgentHelper.NotesMainHelper(_CriminalInvestigationsAgentHelper.java:165_)
>
>         at
> CriminalInvestigationsAgent.NotesMain(_CriminalInvestigationsAgent.java:74_)
>
>         at
> CriminalInvestigationsAgent.main(_CriminalInvestigationsAgent.java:48_)
> _java.lang.ClassCastException_:
> org.bouncycastle.jce.provider.BouncyCastleProvider
>         at
> org.apache.ws.security.components.crypto.CryptoFactory.loadClass(_CryptoFactory.java:127_)
>
>         at
> org.apache.ws.security.components.crypto.CryptoFactory.getInstance(_CryptoFactory.java:101_)
>
>         at
> ca.on.gov.jus.justiceconnect.CriminalInvestigationsServiceSoapStub.createCall(_CriminalInvestigationsServiceSoapStub.java:131_)
>
>         at
> ca.on.gov.jus.justiceconnect.CriminalInvestigationsServiceSoapStub.submitMajorCaseInvestigation(_CriminalInvestigationsServiceSoapStub.java:151_)
>
>         at
> ca.on.gov.jus.justiceconnect.CriminalInvestigationsAgentHelper.NotesMainHelper(_CriminalInvestigationsAgentHelper.java:165_)
>
>         at
> CriminalInvestigationsAgent.NotesMain(_CriminalInvestigationsAgent.java:74_)
>
>         at
> CriminalInvestigationsAgent.main(_CriminalInvestigationsAgent.java:48_)
> - Failure trying to get the Call object; nested exception is:
>         _java.lang.RuntimeException_:
> org.bouncycastle.jce.provider.BouncyCastleProvider cannot create instance


Reply via email to