OK, so I think I found the problem. I noticed that org.apache.ws.security.components.crypto.BouncyCastle does not have the same constructors as org.apache.ws.security.components.crypto.Merlin.
Merlin has:
public Merlin(Properties properties) throws CredentialException, IOException {
super(properties);
}
public Merlin(Properties properties, ClassLoader loader) throws CredentialException, IOException {
super(properties,loader);
}
And BouncyCastle has:
public BouncyCastle(Properties properties) throws CredentialException, IOException {
super(properties);
}
And the CryptoFactory only tries to use the constructor with Properties and ClassLoader parameters, so that throws an error.
My test passes if I add the second constructor to BouncyCastle.
So, is this a bug? It seems so to me, but hasn't this been working for others? And what's the purpose of the first constructor (Properties only) if its never used?
- David
Werner Dittmann <[EMAIL PROTECTED]> wrote on 02/04/2006 02:31:10 AM:
> The appropriate BC jar file would be
>
> jce-jdk13-130.jar or jce-jdk13-131.jar
>
> because Java 1.3 does not have a JCE implementation and thus
> it must be provided by BouncyCastle. Without this the
> WSS4J BouncyCastle crypto provider cannot be instantiated.
>
> Regards,
> Werner
>
> [EMAIL PROTECTED] wrote:
> >
> > 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
> >
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
- How to use with JDK 1.3 DFrahm
- Re: How to use with JDK 1.3 Werner Dittmann
- Re: How to use with JDK 1.3 DFrahm
- Re: How to use with JDK 1.3 Werner Dittmann
- Re: How to use with JDK 1.3 DFrahm
- Re: How to use with JDK 1.3 DFrahm
