Advertisement

03.12.2008 at 06:02AM PDT, ID: 23234869
[x]
Attachment Details

How to plug in Bouncy Castle jar into Websphere Application Server 5.1.x.?

Asked by Sirish_Nukala in IBM Websphere Application Server, Java Programming Language, WebApplications

Tags: JAVA

Hi .,

      I'm getting an exception when I tried running a program which generates PGP key pair using Bouncy Castle, in the Websphere Application Server.Actually I'm ruuning a web application on this server and generation of PGP keys is a part of its functionality..!

I have tried adding the bouncy castle provider jar to the websphere app server jvm butm it did not solve my problem.

If there are any one who are aware how to plugin this jar to websphere app server.., Please help me .?

This is a production issue.I need it to resolve this ASAP.

Thankx in advance.

I'm getting a huge exception ----

java.lang.NoClassDefFoundError: Error while defining class: org.bouncycastle.jce.provider.JCEPBEKey
This error indicates that the class: javax.crypto.interfaces.PBEKey
could not be located while defining the class: org.bouncycastle.jce.provider.JCEPBEKey
This is often caused by having the class at a higher point in the classloader hierarchy
Dumping the current context classloader hierarchy:
    ==> indicates defining classloader
    *** indicates classloader where the missing class could have been found
==>[0]
com.ibm.ws.classloader.CompoundClassLoader@29e69cb2
   Local ClassPath: C:\11Mar2008TPProject\TPWeb\WebContent\WEB-INF\classes;C:\11Mar2008TPProject\TPWeb\WebContent\WEB-INF\lib\aet-spring-1.0.jar;C:\11Mar2008TPProject\TPWeb\WebContent\WEB-INF\lib\aopalliance.jar;C:\11Mar2008TPProject\TPWeb\WebContent\WEB-INF\lib\bcmail-jdk14-137.jar;C:\11Mar2008TPProject\TPWeb\WebContent\WEB-INF\lib\bcpg-jdk14-137.jar;C:\11Mar2008TPProject\TPWeb\WebContent\WEB-INF\lib\bcprov-jdk14-137.jar;C:\11Mar2008TPProject\TPWeb\WebContent\WEB-INF\lib\bctest-jdk14-137.jar;C:\11Mar2008TPProject\TPWeb\WebContent\WEB-INF\lib\bctsp-jdk14-137.jar;C:\11Mar2008TPProject\TPWeb\WebContent\WEB-INF\lib\cglib-nodep-2.1_2.jar;C:\11Mar2008TPProject\TPWeb\WebContent\WEB-INF\lib\com.ibm.mq.jar;C:\11Mar2008TPProject\TPWeb\WebContent\WEB-INF\lib\commons-attributes-api.jar;C:\11Mar2008TPProject\TPWeb\WebContent\WEB-INF\lib\commons-beanutils.jar;C:\11Mar2008TPProject\TPWeb\WebContent\WEB-INF\lib\commons-collections.jar;C:\11Mar2008TPProject\TPWeb\WebContent\WEB-INF\lib\commons-dbcp.jar;C:\11Mar2008TPProject\TPWeb\WebContent\WEB-INF\lib\commons-digester.jar;C:\11Mar2008TPProject\TPWeb\WebContent\WEB-INF\lib\commons-fileupload.jar;C:\11Mar2008TPProject\TPWeb\WebContent\WEB-INF\lib\commons-lang.jar;C:\11Mar2008TPProject\TPWeb\WebContent\WEB-INF\lib\commons-logging.jar;C:\11Mar2008TPProject\TPWeb\WebContent\WEB-INF\lib\commons-pool.jar;C:\11Mar2008TPProject\TPWeb\WebContent\WEB-INF\lib\commons-validator.jar;C:\11Mar2008TPProject\TPWeb\WebContent\WEB-INF\lib\cryptix32.jar;C:\11Mar2008TPProject\TPWeb\WebContent\WEB-INF\lib\db2jcc.jar;C:\11Mar2008TPProject\TPWeb\WebContent\WEB-INF\lib\db2jcc_license_cisuz.jar;C:\11Mar2008TPProject\TPWeb\WebContent\WEB-INF\lib\dcache_5.0.jar;C:\11Mar2008TPProject\TPWeb\WebContent\WEB-INF\lib\dcache_sample.jar;C:\11Mar2008TPProject\TPWeb\WebContent\WEB-INF\lib\dcache_startup_5.0.jar;C:\11Mar2008TPProject\TPWeb\WebContent\WEB-INF\lib\dom.jar;C:\11Mar2008TPProject\TPWeb\WebContent\WEB-INF\lib\jakarta-oro-2.0.8.jar;C:\11Mar2008TPProject\TPWeb\WebContent\WEB-INF\lib\jax-qname.jar;C:\11Mar2008TPProject\TPWeb\WebContent\WEB-INF\lib\jaxb-api.jar;C:\11Mar2008TPProject\TPWeb\WebContent\WEB-INF\lib\jaxb-impl.jar;C:\11Mar2008TPProject\TPWeb\WebContent\WEB-INF\lib\jaxb-libs.jar;C:\11Mar2008TPProject\TPWeb\WebContent\WEB-INF\lib\jaxb-sft.jar;C:\11Mar2008TPProject\TPWeb\WebContent\WEB-INF\lib\jaxb-xjc.jar;C:\11Mar2008TPProject\TPWeb\WebContent\WEB-INF\lib\jaxp-api.jar;C:\11Mar2008TPProject\TPWeb\WebContent\WEB-INF\lib\jconfig_1.jar;C:\11Mar2008TPProject\TPWeb\WebContent\WEB-INF\lib\jpf_1.0.jar;C:\11Mar2008TPProject\TPWeb\WebContent\WEB-INF\lib\jstl.jar;C:\11Mar2008TPProject\TPWeb\WebContent\WEB-INF\lib\juice.jar;C:\11Mar2008TPProject\TPWeb\WebContent\WEB-INF\lib\jutil_xml.jar;C:\11Mar2008TPProject\TPWeb\WebContent\WEB-INF\lib\ldapjdk.jar;C:\11Mar2008TPProject\TPWeb\WebContent\WEB-INF\lib\log4j-1.2.11.jar;C:\11Mar2008TPProject\TPWeb\WebContent\WEB-INF\lib\log4jamex_1_0_0.jar;C:\11Mar2008TPProject\TPWeb\WebContent\WEB-INF\lib\namespace.jar;C:\11Mar2008TPProject\TPWeb\WebContent\WEB-INF\lib\pool.jar;C:\11Mar2008TPProject\TPWeb\WebContent\WEB-INF\lib\relaxngDatatype.jar;C:\11Mar2008TPProject\TPWeb\WebContent\WEB-INF\lib\sax.jar;C:\11Mar2008TPProject\TPWeb\WebContent\WEB-INF\lib\servicelocator.jar;C:\11Mar2008TPProject\TPWeb\WebContent\WEB-INF\lib\SFTSiteReplication.jar;C:\11Mar2008TPProject\TPWeb\WebContent\WEB-INF\lib\SFTSiteReplication_jaxb.jar;C:\11Mar2008TPProject\TPWeb\WebContent\WEB-INF\lib\standard.jar;C:\11Mar2008TPProject\TPWeb\WebContent\WEB-INF\lib\threadpool.jar;C:\11Mar2008TPProject\TPWeb\WebContent\WEB-INF\lib\utils.jar;C:\11Mar2008TPProject\TPWeb\WebContent\WEB-INF\lib\xercesImpl.jar;C:\11Mar2008TPProject\TPWeb\WebContent\WEB-INF\lib\xml-apis.jar;C:\11Mar2008TPProject\TPWeb\WebContent\WEB-INF\lib\xsdlib.jar;C:\11Mar2008TPProject\TPWeb\WebContent;
   Delegation Mode: PARENT_FIRST
   [1] com.ibm.ws.classloader.JarClassLoader@701127858 Local Classpath:  Delegation mode: PARENT_FIRST
   [2] com.ibm.ws.classloader.ExtJarClassLoader@217537708 Local ClassPath: C:\Program Files\IBM\WebSphere Studio\Application Developer\v5.1\runtimes\base_v5\lib\app;  Delegation Mode: PARENT_LAST
   [3] com.ibm.ws.classloader.ProtectionClassLoader@400c5ca9
   [4] com.ibm.ws.bootstrap.ExtClassLoader@4f0f5ca1
   [5] sun.misc.Launcher$AppClassLoader@4f045ca1
   [6] sun.misc.Launcher$ExtClassLoader@4cf99ca1
---Original exception---
java.lang.NoClassDefFoundError: javax/crypto/interfaces/PBEKey
      at java.lang.ClassLoader.defineClass0(Native Method)
      at java.lang.ClassLoader.defineClass(ClassLoader.java(Compiled Code))
      at java.security.SecureClassLoader.defineClass(SecureClassLoader.java(Compiled Code))
      at com.ibm.ws.classloader.CompoundClassLoader._defineClass(CompoundClassLoader.java:407)
      at com.ibm.ws.classloader.CompoundClassLoader.findClass(CompoundClassLoader.java(Compiled Code))
      at com.ibm.ws.classloader.CompoundClassLoader.loadClass(CompoundClassLoader.java(Compiled Code))
      at java.lang.ClassLoader.loadClass(ClassLoader.java(Compiled Code))
      at org.bouncycastle.jce.provider.JCEBlockCipher.engineInit(Unknown Source)
      at org.bouncycastle.jce.provider.JCEBlockCipher.engineInit(Unknown Source)
      at javax.crypto.Cipher.init(Unknown Source)
      at org.bouncycastle.openpgp.PGPSecretKey.<init>(Unknown Source)
      at org.bouncycastle.openpgp.PGPSecretKey.<init>(Unknown Source)
      at org.bouncycastle.openpgp.PGPSecretKey.<init>(Unknown Source)
      at org.bouncycastle.openpgp.PGPSecretKey.<init>(Unknown Source)
      at com.americanexpress.tp.util.RSAKeyPairGenerator.exportKeyPair(RSAKeyPairGenerator.java:58)
      at com.americanexpress.tp.util.RSAKeyPairGenerator.abc(RSAKeyPairGenerator.java:121)
      at com.americanexpress.tp.action.fileflow.CatalogStepAction.generateKeyPair(CatalogStepAction.java:940)
      at java.lang.reflect.Method.invoke(Native Method)
      at org.apache.struts.actions.DispatchAction.dispatchMethod(Unknown Source)
      at org.apache.struts.actions.LookupDispatchAction.execute(Unknown Source)
............................ ...........................
(OSEListener.java:334)
      at com.ibm.ws.webcontainer.http.HttpConnection.handleRequest(HttpConnection.java:56)
      at com.ibm.ws.http.HttpConnection.readAndHandleRequest(HttpConnection.java:610)
      at com.ibm.ws.http.HttpConnection.run(HttpConnection.java:435)
      at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:593)

--- end Original exception----
[3/12/05 17:25:29:984 IST] 7f549cbe SystemErr     R
java.lang.NoClassDefFoundError: Error while defining class: org.bouncycastle.jce.provider.JCEPBEKey
This error indicates that the class: javax.crypto.interfaces.PBEKey
could not be located while defining the class: org.bouncycastle.jce.provider.JCEPBEKey
This is often caused by having the class at a higher point in the classloader hierarchy
Dumping the current context classloader hierarchy:
    ==> indicates defining classloader
    *** indicates classloader where the missing class could have been found
==>[0]
com.ibm.ws.classloader.CompoundClassLoader@29e69cb2
   Local ClassPath: C:\11Mar2008TPProject\TPWeb\WebContent\WEB-INF\classes;C:\11Mar2008TPProject\TPWeb\WebContent\WEB-INF\lib\aet-spring-1.0.jar;C:\11Mar2008TPProject\TPWeb\WebContent\WEB-INF\lib\aopalliance.jar;C:\11Mar2008TPProject\TPWeb\WebContent\WEB-INF\lib\bcmail-jdk14-137.jar;C:\11Mar2008TPProject\TPWeb\WebContent\WEB-INF\lib\bcpg-jdk14-137.jar;C:\11Mar2008TPProject\TPWeb\WebContent\WEB-INF\lib\bcprov-jdk14-137.jar;C:\11Mar2008TPProject\TPWeb\WebContent\WEB-INF\lib\bctest-jdk14-137.jar;C:\11Mar2008TPProject\TPWeb\WebContent\WEB-INF\lib\bctsp-jdk14-137.jar;C:\11Mar2008TPProject\TPWeb\WebContent\WEB-INF\lib\cglib-nodep-2.1_2.jar;C:\11Mar2008TPProject\TPWeb\WebContent\WEB-INF\lib\com.ibm.mq.jar;C:\11Mar2008TPProject\TPWeb\WebContent\WEB-INF\lib\commons-attributes-api.jar;C:\11Mar2008TPProject\TPWeb\WebContent\WEB-INF\lib\commons-beanutils.jar;C:\11Mar2008TPProject\TPWeb\WebContent\WEB-INF\lib\commons-collections.jar;C:\11Mar2008TPProject\TPWeb\WebContent\WEB-INF\lib\commons-dbcp.jar;C:\11Mar2008TPProject\TPWeb\WebContent\WEB-INF\lib\commons-digester.jar;C:\11Mar2008TPProject\TPWeb\WebContent\WEB-INF\lib\commons-fileupload.jar;C:\11Mar2008TPProject\TPWeb\WebContent\WEB-INF\lib\commons-lang.jar;C:\11Mar2008TPProject\TPWeb\WebContent\WEB-INF\lib\commons-logging.jar;C:\11Mar2008TPProject\TPWeb\WebContent\WEB-INF\lib\commons-pool.jar;C:\11Mar2008TPProject\TPWeb\WebContent\WEB-INF\lib\commons-validator.jar;C:\11Mar2008TPProject\TPWeb\WebContent\WEB-INF\lib\cryptix32.jar;C:\11Mar2008TPProject\TPWeb\WebContent\WEB-INF\lib\db2jcc.jar;C:\11Mar2008TPProject\TPWeb\WebContent\WEB-INF\lib\db2jcc_license_cisuz.jar;C:\11Mar2008TPProject\TPWeb\WebContent\WEB-INF\lib\dcache_5.0.jar;C:\11Mar2008TPProject\TPWeb\WebContent\WEB-INF\lib\dcache_sample.jar;C:\11Mar2008TPProject\TPWeb\WebContent\WEB-INF\lib\dcache_startup_5.0.jar;C:\11Mar2008TPProject\TPWeb\WebContent\WEB-INF\lib\dom.jar;C:\11Mar2008TPProject\TPWeb\WebContent\WEB-INF\lib\jakarta-oro-2.0.8.jar;C:\11Mar2008TPProject\TPWeb\WebContent\WEB-INF\lib\jax-qname.jar;C:\11Mar2008TPProject\TPWeb\WebContent\WEB-INF\lib\jaxb-api.jar;C:\11Mar2008TPProject\TPWeb\WebContent\WEB-INF\lib\jaxb-impl.jar;C:\11Mar2008TPProject\TPWeb\WebContent\WEB-INF\lib\jaxb-libs.jar;C:\11Mar2008TPProject\TPWeb\WebContent\WEB-INF\lib\jaxb-sft.jar;C:\11Mar2008TPProject\TPWeb\WebContent\WEB-INF\lib\jaxb-xjc.jar;C:\11Mar2008TPProject\TPWeb\WebContent\WEB-INF\lib\jaxp-api.jar;C:\11Mar2008TPProject\TPWeb\WebContent\WEB-INF\lib\jconfig_1.jar;C:\11Mar2008TPProject\TPWeb\WebContent\WEB-INF\lib\jpf_1.0.jar;C:\11Mar2008TPProject\TPWeb\WebContent\WEB-INF\lib\jstl.jar;C:\11Mar2008TPProject\TPWeb\WebContent\WEB-INF\lib\juice.jar;C:\11Mar2008TPProject\TPWeb\WebContent\WEB-INF\lib\jutil_xml.jar;C:\11Mar2008TPProject\TPWeb\WebContent\WEB-INF\lib\ldapjdk.jar;C:\11Mar2008TPProject\TPWeb\WebContent\WEB-INF\lib\log4j-1.2.11.jar;C:\11Mar2008TPProject\TPWeb\WebContent\WEB-INF\lib\log4jamex_1_0_0.jar;C:\11Mar2008TPProject\TPWeb\WebContent\WEB-INF\lib\namespace.jar;C:\11Mar2008TPProject\TPWeb\WebContent\WEB-INF\lib\pool.jar;C:\11Mar2008TPProject\TPWeb\WebContent\WEB-INF\lib\relaxngDatatype.jar;C:\11Mar2008TPProject\TPWeb\WebContent\WEB-INF\lib\sax.jar;C:\11Mar2008TPProject\TPWeb\WebContent\WEB-INF\lib\servicelocator.jar;C:\11Mar2008TPProject\TPWeb\WebContent\WEB-INF\lib\SFTSiteReplication.jar;C:\11Mar2008TPProject\TPWeb\WebContent\WEB-INF\lib\SFTSiteReplication_jaxb.jar;C:\11Mar2008TPProject\TPWeb\WebContent\WEB-INF\lib\standard.jar;C:\11Mar2008TPProject\TPWeb\WebContent\WEB-INF\lib\threadpool.jar;C:\11Mar2008TPProject\TPWeb\WebContent\WEB-INF\lib\utils.jar;C:\11Mar2008TPProject\TPWeb\WebContent\WEB-INF\lib\xercesImpl.jar;C:\11Mar2008TPProject\TPWeb\WebContent\WEB-INF\lib\xml-apis.jar;C:\11Mar2008TPProject\TPWeb\WebContent\WEB-INF\lib\xsdlib.jar;C:\11Mar2008TPProject\TPWeb\WebContent;
   Delegation Mode: PARENT_FIRST
   [1] com.ibm.ws.classloader.JarClassLoader@701127858 Local Classpath:  Delegation mode: PARENT_FIRST
   [2] com.ibm.ws.classloader.ExtJarClassLoader@217537708 Local ClassPath: C:\Program Files\IBM\WebSphere Studio\Application Developer\v5.1\runtimes\base_v5\lib\app;  Delegation Mode: PARENT_LAST
   [3] com.ibm.ws.classloader.ProtectionClassLoader@400c5ca9
   [4] com.ibm.ws.bootstrap.ExtClassLoader@4f0f5ca1
   [5] sun.misc.Launcher$AppClassLoader@4f045ca1
   [6] sun.misc.Launcher$ExtClassLoader@4cf99ca1
---Original exception---
java.lang.NoClassDefFoundError: javax/crypto/interfaces/PBEKey
      at java.lang.ClassLoader.defineClass0(Native Method)
      at java.lang.ClassLoader.defineClass(ClassLoader.java(Compiled Code))
      at java.security.SecureClassLoader.defineClass(SecureClassLoader.java(Compiled Code))
      at com.ibm.ws.classloader.CompoundClassLoader._defineClass(CompoundClassLoader.java:407)
      at com.ibm.ws.classloader.CompoundClassLoader.findClass(CompoundClassLoader.java(Compiled Code))
      at com.ibm.ws.classloader.CompoundClassLoader.loadClass(CompoundClassLoader.java(Compiled Code))
      at java.lang.ClassLoader.loadClass(ClassLoader.java(Compiled Code))
      at org.bouncycastle.jce.provider.JCEBlockCipher.engineInit(Unknown Source)
      at org.bouncycastle.jce.provider.JCEBlockCipher.engineInit(Unknown Source)
      at javax.crypto.Cipher.init(Unknown Source)
      at org.bouncycastle.openpgp.PGPSecretKey.<init>(Unknown Source)
      at org.bouncycastle.openpgp.PGPSecretKey.<init>(Unknown Source)
      at org.bouncycastle.openpgp.PGPSecretKey.<init>(Unknown Source)
      at org.bouncycastle.openpgp.PGPSecretKey.<init>(Unknown Source)
      at com.americanexpress.tp.util.RSAKeyPairGenerator.exportKeyPair(RSAKeyPairGenerator.java:58)
      at com.americanexpress.tp.util.RSAKeyPairGenerator.abc(RSAKeyPairGenerator.java:121)
      at com.americanexpress.tp.action.fileflow.CatalogStepAction.generateKeyPair
........................
(ServletRequestProcessor.java:186)
      at com.ibm.ws.webcontainer.oselistener.OSEListenerDispatcher.service(OSEListener.java:334)
      at com.ibm.ws.webcontainer.http.HttpConnection.handleRequest(HttpConnection.java:56)
      at com.ibm.ws.http.HttpConnection.readAndHandleRequest(HttpConnection.java:610)
      at com.ibm.ws.http.HttpConnection.run(HttpConnection.java:435)
      at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:593)

--- end Original exception----

[3/12/05 17:25:29:984 IST] 7f549cbe SystemErr     R       at com.ibm.ws.classloader.CompoundClassLoader._defineClass(CompoundClassLoader.java:434)
[3/12/05 17:25:29:984 IST] 7f549cbe SystemErr     R       at com.ibm.ws.classloader.CompoundClassLoader.findClass(CompoundClassLoader.java(Compiled Code))
[3/12/05 17:25:29:984 IST] 7f549cbe SystemErr     R       at com.ibm.ws.classloader.CompoundClassLoader.loadClass(CompoundClassLoader.java(Compiled Code))
[3/12/05 17:25:29:984 IST] 7f549cbe SystemErr     R       at java.lang.ClassLoader.loadClass(ClassLoader.java(Compiled Code))
[3/12/05 17:25:29:984 IST] 7f549cbe SystemErr     R       at org.bouncycastle.jce.provider.JCEBlockCipher.engineInit(Unknown Source)
[3/12/05 17:25:29:984 IST] 7f549cbe SystemErr     R       at org.bouncycastle.jce.provider.JCEBlockCipher.engineInit(Unknown Source)
[3/12/05 17:25:29:984 IST] 7f549cbe SystemErr     R       at javax.crypto.Cipher.init(Unknown Source)
[3/12/05 17:25:29:984 IST] 7f549cbe SystemErr     R       at org.bouncycastle.openpgp.PGPSecretKey.<init>(Unknown Source)
[3/12/05 17:25:29:984 IST] 7f549cbe SystemErr     R       at org.bouncycastle.openpgp.PGPSecretKey.<init>(Unknown Source)
[3/12/05 17:25:29:984 IST] 7f549cbe SystemErr     R       at org.bouncycastle.openpgp.PGPSecretKey.<init>(Unknown Source)
[3/12/05 17:25:29:984 IST] 7f549cbe SystemErr     R       at org.bouncycastle.openpgp.PGPSecretKey.<init>(Unknown Source)
[3/12/05 17:25:29:984 IST] 7f549cbe SystemErr     R       at com.americanexpress.tp.util.RSAKeyPairGenerator.exportKeyPair(RSAKeyPairGenerator.java:58)
[3/12/05 17:25:29:984 IST] 7f549cbe SystemErr     R       at com.americanexpress.tp.util.RSAKeyPairGenerator.abc(RSAKeyPairGenerator.java:121)
[3/12/05 17:25:29:984 IST] 7f549cbe SystemErr     R       at com.americanexpress.tp.action.fileflow.CatalogStepAction.generateKeyPair(CatalogStepAction.java:940)
[3/12/05 17:25:29:984 IST] 7f549cbe SystemErr     R       at java.lang.reflect.Method.invoke(Native Method)
[3/12/05 17:25:29:984 IST] 7f549cbe SystemErr     R       at org.apache.struts.actions.DispatchAction.dispatchMethod(Unknown Source)
[3/12/05 17:25:29:984 IST] 7f549cbe SystemErr     R       at org.apache.struts.actions.LookupDispatchAction.execute(Unknown Source)
[3/12/05 17:25:29:984 IST] 7f549cbe SystemErr     R       at org.apache.struts.action.RequestProcessor.processActionPerform(Unknown Source)
[3/12/05 17:25:29:984 IST] 7f549cbe SystemErr     R       at org.apache.struts.action.RequestProcessor.process(Unknown Source)
[3/12/05 17:25:29:984 IST] 7f549cbe SystemErr     R       at com.americanexpress.util.spring.integration.AETSpringTilesRequestProcessor.process(AETSpringTilesRequestProcessor.java:56)
[3/12/05 17:25:29:984 IST] 7f549cbe SystemErr     R       at org.apache.struts.action.ActionServlet.process(Unknown Source)
[3/12/05 17:25:29:984 IST] 7f549cbe SystemErr     R       at org.apache.struts.action.ActionServlet.doPost(Unknown Source)
[3/12/05 17:25:29:984 IST] 7f549cbe SystemErr     R       at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
[3/12/05 17:25:29:984 IST] 7f549cbe SystemErr     R       at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
[3/12/05 17:25:29:984 IST] 7f549cbe SystemErr     R       at com.ibm.ws.webcontainer.servlet.StrictServletInstance.doService(StrictServletInstance.java:110)
[3/12/05 17:25:29:984 IST] 7f549cbe SystemErr     R       at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet._service(StrictLifecycleServlet.java:174)
[3/12/05 17:25:29:984 IST] 7f549cbe SystemErr     R       at com.ibm.ws.webcontainer.servlet.IdleServletState.service(StrictLifecycleServlet.java:313)
[3/12/05 17:25:29:984 IST] 7f549cbe SystemErr     R       at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet.service(StrictLifecycleServlet.java:116)
[3/12/05 17:25:29:984 IST] 7f549cbe SystemErr     R       at com.ibm.ws.webcontainer.servlet.ServletInstance.service(ServletInstance.java:283)
[3/12/05 17:25:29:984 IST] 7f549cbe SystemErr     R       at com.ibm.ws.webcontainer.servlet.ValidServletReferenceState.dispatch(ValidServletReferenceState.java:42)
[3/12/05 17:25:29:984 IST] 7f549cbe SystemErr     R       at com.ibm.ws.webcontainer.servlet.ServletInstanceReference.dispatch(ServletInstanceReference.java:40)
[3/12/05 17:25:29:984 IST] 7f549cbe SystemErr     R       at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:61)
[3/12/05 17:25:29:984 IST] 7f549cbe SystemErr     R       at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.handleWebAppDispatch(WebAppRequestDispatcher.java:939)
[3/12/05 17:25:29:984 IST] 7f549cbe SystemErr     R       at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.dispatch(WebAppRequestDispatcher.java:530)
[3/12/05 17:25:29:984 IST] 7f549cbe SystemErr     R       at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.forward(WebAppRequestDispatcher.java:176)
[3/12/05 17:25:29:984 IST] 7f549cbe SystemErr     R       at com.ibm.ws.webcontainer.srt.WebAppInvoker.doForward(WebAppInvoker.java:79)
[3/12/05 17:25:29:984 IST] 7f549cbe SystemErr     R       at com.ibm.ws.webcontainer.srt.WebAppInvoker.handleInvocationHook(WebAppInvoker.java:201)
[3/12/05 17:25:29:984 IST] 7f549cbe SystemErr     R       at com.ibm.ws.webcontainer.cache.invocation.CachedInvocation.handleInvocation(CachedInvocation.java:71)
[3/12/05 17:25:29:984 IST] 7f549cbe SystemErr     R       at com.ibm.ws.webcontainer.cache.invocation.CacheableInvocationContext.invoke(CacheableInvocationContext.java:114)
[3/12/05 17:25:29:984 IST] 7f549cbe SystemErr     R       at com.ibm.ws.webcontainer.srp.ServletRequestProcessor.dispatchByURI(ServletRequestProcessor.java:186)
[3/12/05 17:25:29:984 IST] 7f549cbe SystemErr     R       at com.ibm.ws.webcontainer.oselistener.OSEListenerDispatcher.service(OSEListener.java:334)
[3/12/05 17:25:29:984 IST] 7f549cbe SystemErr     R       at com.ibm.ws.webcontainer.http.HttpConnection.handleRequest(HttpConnection.java:56)
[3/12/05 17:25:29:984 IST] 7f549cbe SystemErr     R       at com.ibm.ws.http.HttpConnection.readAndHandleRequest(HttpConnection.java:610)
[3/12/05 17:25:29:984 IST] 7f549cbe SystemErr     R       at com.ibm.ws.http.HttpConnection.run(HttpConnection.java:435)
[3/12/05 17:25:29:984 IST] 7f549cbe SystemErr     R       at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:593)
[3/12/05 17:25:29:984 IST] 7f549cbe SystemErr     R java.lang.NullPointerException
[3/12/05 17:25:29:984 IST] 7f549cbe SystemErr     R       at com.americanexpress.tp.util.RSAKeyPairGenerator.exportKeyPair(RSAKeyPairGenerator.java:68)
[3/12/05 17:25:29:984 IST] 7f549cbe SystemErr     R       at com.americanexpress.tp.util.RSAKeyPairGenerator.abc(RSAKeyPairGenerator.java:121)
[3/12/05 17:25:29:984 IST] 7f549cbe SystemErr     R       at com.americanexpress.tp.action.fileflow.CatalogStepAction.generateKeyPair(CatalogStepAction.java:940)
[3/12/05 17:25:29:984 IST] 7f549cbe SystemErr     R       at java.lang.reflect.Method.invoke(Native Method)
[3/12/05 17:25:29:984 IST] 7f549cbe SystemErr     R       at org.apache.struts.actions.DispatchAction.dispatchMethod(Unknown Source)
[3/12/05 17:25:29:984 IST] 7f549cbe SystemErr     R       at org.apache.struts.actions.LookupDispatchAction.execute(Unknown Source)
[3/12/05 17:25:29:984 IST] 7f549cbe SystemErr     R       at org.apache.struts.action.RequestProcessor.processActionPerform(Unknown Source)
................... ....................
[3/12/05 17:25:29:984 IST] 7f549cbe SystemErr     R       at com.ibm.ws.http.HttpConnection.run(HttpConnection.java:435)
[3/12/05 17:25:29:984 IST] 7f549cbe SystemErr     R       at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:593)
[3/12/05 17:25:30:016 IST] 7f549cbe SystemOut     O | REQ_ACTION | /ViewCatalog | RES_PAGE |editCatalogStep | CON_COUNT | 2| TIME | 16

Start Free Trial
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
94:
95:
96:
97:
98:
99:
100:
101:
102:
103:
104:
105:
106:
107:
108:
109:
110:
111:
112:
113:
114:
115:
116:
117:
118:
119:
120:
121:
122:
123:
124:
125:
126:
127:
128:
129:
130:
131:
132:
133:
134:
135:
CLASS -
 
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.security.InvalidKeyException;
import java.security.KeyPair;
import java.security.KeyPairGenerator;
import java.security.NoSuchProviderException;
import java.security.PrivateKey;
import java.security.PublicKey;
import java.security.SecureRandom;
import java.security.Security;
import java.security.SignatureException;
import java.util.Date;
import java.util.HashMap;
 
import org.bouncycastle.bcpg.ArmoredOutputStream;
import org.bouncycastle.jce.provider.BouncyCastleProvider;
import org.bouncycastle.openpgp.PGPEncryptedData;
import org.bouncycastle.openpgp.PGPException;
import org.bouncycastle.openpgp.PGPPublicKey;
import org.bouncycastle.openpgp.PGPSecretKey;
import org.bouncycastle.openpgp.PGPSignature;
 
 
/**
 * A simple utility class that generates a RSA PGPPublicKey/PGPSecretKey pair.
 * <p>
 * usage: RSAKeyPairGenerator [-a] identity passPhrase
 * <p>
 * Where identity is the name to be associated with the public key. The keys are placed 
 * in the files pub.[asc|bpg] and secret.[asc|bpg].
 */
public class RSAKeyPairGenerator
{
	private static void exportKeyPair(
		OutputStream    secretOut,
		OutputStream    publicOut,
		PublicKey       publicKey,
		PrivateKey      privateKey,
		String          identity,
		char[]          passPhrase,
		boolean         armor)
		throws  InvalidKeyException   
			{    
				PGPSecretKey    secretKey = null;
		System.out.println("exportKeyPair1111");
		try {
		if (armor)
		{
			secretOut = new ArmoredOutputStream(secretOut);
		}
		System.out.println("exportKeyPair2222");
		try{
		secretKey = new PGPSecretKey(PGPSignature.POSITIVE_CERTIFICATION, 
				PGPPublicKey.RSA_GENERAL, publicKey, 
				privateKey, new Date(), identity, 
				PGPEncryptedData.CAST5, passPhrase, 
				null, null, new SecureRandom(), TPConstants.PROVIDER_BOUNCY_CASTLE);
		}
		catch(Throwable e){
			System.out.println("exportKeyPair2.1"+e);
			e.printStackTrace();
		}
		PGPPublicKey pgpPubKey = secretKey.getPublicKey();
		System.out.println("exportKeyPair3333");
		secretKey.encode(secretOut);
		secretOut.close();
		System.out.println("exportKeyPair44444");
		if (armor)
		{
			publicOut = new ArmoredOutputStream(publicOut);
		}
		System.out.println("exportKeyPair5555");
		PGPPublicKey    key = secretKey.getPublicKey();
		System.out.println("exportKeyPair1111");
		key.encode(publicOut);
		publicOut.close();
		System.out.println("exportKeyPair6666");
		}
//	catch(PGPException pgpException){
//		pgpException.printStackTrace();
//
//	}
//	catch(NoSuchProviderException noSuchProviderException){
//			
//		noSuchProviderException.printStackTrace();
//	}
	catch(IOException exp){
		exp.printStackTrace();			
 
	}
    	
		System.out.println("Keys are generated sucessfully");
	}
    
 
	public static HashMap abc()
	{
		System.out.println("abc1111");
		String passPharse	= "abc";
		String keyIdentity = "abc";
		System.out.println("abc2222");
		HashMap map = new HashMap();
		try{
		Security.insertProviderAt(new org.bouncycastle.jce.provider.BouncyCastleProvider(),2);
		System.out.println("abc3333");
		KeyPairGenerator    kpg 				= KeyPairGenerator.getInstance(TPConstants.RSA_KEY_ALGORITHM,TPConstants.PROVIDER_BOUNCY_CASTLE);
		System.out.println("abc4444");
		kpg.initialize(1024);
		System.out.println("abc5555");
		KeyPair kp								= kpg.generateKeyPair();
		System.out.println("abc6666");
 
		ByteArrayOutputStream secKeybiteArray = new ByteArrayOutputStream();
		ByteArrayOutputStream pubKeybiteArray = new ByteArrayOutputStream();
		System.out.println("abc77777");
		exportKeyPair(secKeybiteArray, pubKeybiteArray, kp.getPublic(), kp.getPrivate(),keyIdentity, passPharse.toCharArray(), true);
		System.out.println("abc8888");
		
		map.put("001",secKeybiteArray.toString());
		map.put("002",pubKeybiteArray.toString());
		}
		catch(Exception e){
			e.printStackTrace();
		}
		return map;
        
   //     System.out.println("secKeybiteArray--->"+secKeybiteArray.toString());
   //     System.out.println("pubKeybiteArray--->"+pubKeybiteArray.toString());
        
        
	}
}
 
Loading Advertisement...
 
[+][-]03.12.2008 at 07:23AM PDT, ID: 21106232

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]03.12.2008 at 07:43AM PDT, ID: 21106467

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]03.12.2008 at 08:13AM PDT, ID: 21106826

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]03.13.2008 at 08:04PM PDT, ID: 21122753

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]03.13.2008 at 10:16PM PDT, ID: 21123191

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]03.13.2008 at 10:33PM PDT, ID: 21123234

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]03.14.2008 at 12:37PM PDT, ID: 21128727

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]03.15.2008 at 12:25AM PDT, ID: 21131736

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]03.18.2008 at 08:53AM PDT, ID: 21152381

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]03.18.2008 at 10:02PM PDT, ID: 21158631

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]03.19.2008 at 10:38AM PDT, ID: 21163781

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]03.19.2008 at 09:48PM PDT, ID: 21168407

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]03.20.2008 at 12:23PM PDT, ID: 21174858

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: IBM Websphere Application Server, Java Programming Language, WebApplications
Tags: JAVA
Sign Up Now!
Solution Provided By: SirCrofty
Participating Experts: 2
Solution Grade: A
 
 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628