I've put the following in my lib/ext and tried with neither working: bcpg-jdk16-1.46 and bcprov-jdk16-1.46 (retrieved from ~/.m2/repository/org/bouncycastle as this was the version that works with camel:run) bcpg-jdk15on-147 and bcprov-jdk15on-147 (downloaded from bouncy castle website)
Also, the stack trace has changed with the different versions. For 147: java.security.spec.InvalidKeySpecException: key spec not recognized org.bouncycastle.openpgp.PGPException: exception constructing public key and 146: java.security.spec.InvalidKeySpecException: Unknown KeySpec type: org.bouncycastle.jce.spec.ElGamalPublicKeySpec org.bouncycastle.openpgp.PGPException: exception constructing public key For both versions, ElGamal still does not work but RSA works perfectly. Gaurav -----Original Message----- From: Claus Ibsen [mailto:claus.ib...@gmail.com] Sent: Tuesday, January 29, 2013 3:12 AM To: users@camel.apache.org Subject: Re: Camel-Crypto ElGamal encryption works in mvn camel:run but not in Karaf/OSGi On Tue, Jan 29, 2013 at 3:26 AM, Willem jiang <willem.ji...@gmail.com> wrote: > I just checked the dependency of camel-crypto, it just use > bcprov-jdk15on jar, > The -jdk15on name is AFAIR the naming for JDK 1.5 onwards. Eg also 1.6 and 1.7 But he can check the bouncycastle website to be sure. > <dependency> > <groupId>org.bouncycastle</groupId> > <artifactId>bcpg-jdk15on</artifactId> > <version>${bouncycastle-version}</version> > </dependency> > <dependency> > <groupId>org.bouncycastle</groupId> > <artifactId>bcprov-jdk15on</artifactId> > <version>${bouncycastle-version}</version> > </dependency> > > > > The version is 1.47. > I also checked the website[1], it doesn't has the release of > bcprov-jdk16-xxx.jar. > > Can you try to put that on in your lib/ext directly. > > [1]http://www.bouncycastle.org/latest_releases.html > -- > Willem Jiang > > Red Hat, Inc. > FuseSource is now part of Red Hat > Web: http://www.fusesource.com | http://www.redhat.com > Blog: http://willemjiang.blogspot.com (http://willemjiang.blogspot.com/) > (English) > http://jnn.iteye.com (http://jnn.javaeye.com/) (Chinese) > Twitter: willemjiang > Weibo: 姜宁willem > > > Sent with Sparrow (http://www.sparrowmailapp.com/?sig) > > > On Friday, January 25, 2013 at 2:04 AM, Patel, Gaurav wrote: > >> I have camel 2.10.3 installed and am using the example pubring-ElGamal.gpg >> from >> 'components\camel-crypto\src\test\resources\org\apache\camel\component\crypto' >> in camel-crypto and user 'sd...@nowhere.net (mailto:sd...@nowhere.net)'. >> >> When I run the camel route with mvn camel:run, the RSA encryption works >> perfectly as well as the DSA + ElGamal encryption. When I move this exact >> route to Karaf, the RSA encryption continues to work but the DSA + ElGamal >> gives the following stack trace: >> >> org.bouncycastle.openpgp.PGPException: exception encrypting session >> key at >> org.bouncycastle.openpgp.PGPEncryptedDataGenerator.open(Unknown >> Source) at >> org.bouncycastle.openpgp.PGPEncryptedDataGenerator.open(Unknown >> Source) at >> org.apache.camel.converter.crypto.PGPDataFormat.marshal(PGPDataFormat >> .java:86) at >> org.apache.camel.processor.MarshalProcessor.process(MarshalProcessor. >> java:59) at >> org.apache.camel.util.AsyncProcessorConverterHelper$ProcessorToAsyncP >> rocessorBridge.process(AsyncProcessorConverterHelper.java:61) at >> org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelp >> er.java:73) at >> org.apache.camel.processor.DelegateAsyncProcessor.processNext(Delegat >> eAsyncProcessor.java:99) at >> org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsy >> ncProcessor.java:90) at >> org.apache.camel.management.InstrumentationProcessor.process(Instrume >> ntationProcessor.java:73) at >> org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelp >> er.java:73) at >> org.apache.camel.processor.DelegateAsyncProcessor.processNext(Delegat >> eAsyncProcessor.java:99) at >> org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsy >> ncProcessor.java:90) at >> org.apache.camel.processor.interceptor.TraceInterceptor.process(Trace >> Interceptor.java:91) at >> org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelp >> er.java:73) at >> org.apache.camel.processor.RedeliveryErrorHandler.processErrorHandler >> (RedeliveryErrorHandler.java:334) at >> org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryE >> rrorHandler.java:220) at >> org.apache.camel.processor.RouteContextProcessor.processNext(RouteCon >> textProcessor.java:45) at >> org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsy >> ncProcessor.java:90) at >> org.apache.camel.processor.interceptor.DefaultChannel.process(Default >> Channel.java:303) at >> org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelp >> er.java:73) at >> org.apache.camel.processor.Pipeline.process(Pipeline.java:117) at >> org.apache.camel.processor.Pipeline.process(Pipeline.java:80) at >> org.apache.camel.processor.RouteContextProcessor.processNext(RouteCon >> textProcessor.java:45) at >> org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsy >> ncProcessor.java:90) at >> org.apache.camel.processor.UnitOfWorkProcessor.processAsync(UnitOfWor >> kProcessor.java:150) at >> org.apache.camel.processor.UnitOfWorkProcessor.process(UnitOfWorkProc >> essor.java:117) at >> org.apache.camel.processor.RouteInflightRepositoryProcessor.processNe >> xt(RouteInflightRepositoryProcessor.java:48) at >> org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsy >> ncProcessor.java:90) at >> org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelp >> er.java:73) at >> org.apache.camel.processor.DelegateAsyncProcessor.processNext(Delegat >> eAsyncProcessor.java:99) at >> org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsy >> ncProcessor.java:90) at >> org.apache.camel.management.InstrumentationProcessor.process(Instrume >> ntationProcessor.java:73) at >> org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelp >> er.java:99) at >> org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsy >> ncProcessor.java:86) at >> org.apache.camel.component.jms.EndpointMessageListener.onMessage(Endp >> ointMessageListener.java:104) at >> org.springframework.jms.listener.AbstractMessageListenerContainer.doI >> nvokeListener(AbstractMessageListenerContainer.java:560) at >> org.springframework.jms.listener.AbstractMessageListenerContainer.inv >> okeListener(AbstractMessageListenerContainer.java:498) at >> org.springframework.jms.listener.AbstractMessageListenerContainer.doE >> xecuteListener(AbstractMessageListenerContainer.java:467) at >> org.springframework.jms.listener.AbstractPollingMessageListenerContai >> ner.doReceiveAndExecute(AbstractPollingMessageListenerContainer.java: >> 325) at >> org.springframework.jms.listener.AbstractPollingMessageListenerContai >> ner.receiveAndExecute(AbstractPollingMessageListenerContainer.java:26 >> 3) at >> org.springframework.jms.listener.DefaultMessageListenerContainer$Asyn >> cMessageListenerInvoker.invokeListener(DefaultMessageListenerContaine >> r.java:1058) at >> org.springframework.jms.listener.DefaultMessageListenerContainer$Asyn >> cMessageListenerInvoker.executeOngoingLoop(DefaultMessageListenerCont >> ainer.java:1050) at >> org.springframework.jms.listener.DefaultMessageListenerContainer$Asyn >> cMessageListenerInvoker.run(DefaultMessageListenerContainer.java:947) >> at >> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExec >> utor.java:886) at >> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor >> .java:908) at java.lang.Thread.run(Thread.java:662) Caused by: >> org.bouncycastle.openpgp.PGPException: exception constructing public >> key at org.bouncycastle.openpgp.PGPPublicKey.getKey(Unknown Source) >> at >> org.bouncycastle.openpgp.PGPEncryptedDataGenerator$PubMethod.addSessi >> onInfo(Unknown Source) ... 46 more Caused by: >> java.security.spec.InvalidKeySpecException: key spec not recognised >> at >> org.bouncycastle.jcajce.provider.asymmetric.util.BaseKeyFactorySpi.en >> gineGeneratePublic(Unknown Source) at >> org.bouncycastle.jcajce.provider.asymmetric.elgamal.KeyFactorySpi.eng >> ineGeneratePublic(Unknown Source) at >> java.security.KeyFactory.generatePublic(KeyFactory.java:298) ... 48 >> more >> >> I'm using the jre.properties.cxf (moved to jre.properties) and have this in >> my config.properties: >> # configure karaf security providers >> org.apache.karaf.security.providers = >> org.bouncycastle.jce.provider.BouncyCastleProvider >> >> # javax.transaction is needed to avoid class loader constraint >> violation when using javax.sql >> org.osgi.framework.bootdelegation=org.apache.karaf.jaas.boot,sun.*,co >> m.sun.*,javax.transaction,javax.transaction.*,org.bouncycastle* >> >> I've also loaded bcprov-jdk16-1.46.jar into lib/ext since I'm using Java SDK >> 1.6. >> >> Any suggestions/ideas on what could be wrong? >> >> Gaurav > > -- Claus Ibsen ----------------- Red Hat, Inc. FuseSource is now part of Red Hat Email: cib...@redhat.com Web: http://fusesource.com Twitter: davsclaus Blog: http://davsclaus.com Author of Camel in Action: http://www.manning.com/ibsen