Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
Win a copy of OCP Oracle Certified Professional Java SE 11 Programmer I Study Guide: Exam 1Z0-815 this week in the Programmer Certification forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
  • Knute Snortum
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Ron McLeod
  • Carey Brown
  • Paweł Baczyński
  • Piet Souris
  • Vijitha Kumara

JCE Problem...( help me asap )

Ranch Hand
Posts: 582
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear all,
I am developing applications in OC4J.
But I have problem when implement JCE in OC4J
this is a part of my code...
stKeystoreFile = CryptConstant.stKeystoreFile;
stKeystorePass = CryptConstant.stKeystorePass;
stKeyAlias = CryptConstant.stKeyAlias;
stKeyPass = CryptConstant.stKeyPass;

Security.addProvider(new SunJCE());

char cKeystorePass[] = new char[stKeystorePass.length()];
stKeystorePass.getChars(0, stKeystorePass.length(), cKeystorePass, 0);

char cKeyPass[] = new char[stKeyPass.length()];
stKeyPass.getChars(0, stKeyPass.length(), cKeyPass, 0);

KeyStore objKeystore = KeyStore.getInstance("JKS");

File objFile = new File(stKeystoreFile);

if(objFile.exists()) {
objKeystore.load(new FileInputStream(stKeystoreFile), cKeystorePass);
else {
objKeystore.load(null, cKeystorePass);


PBEKeySpec pbekeyspec = new PBEKeySpec(cKeyPass);

SecretKeyFactory secretkeyfactory = SecretKeyFactory.getInstance("PBEWithMD5AndDES");

objpbeKey = secretkeyfactory.generateSecret(pbekeyspec);

objKeystore.setKeyEntry(stKeyAlias, objpbeKey, cKeyPass, null); FileOutputStream(stKeystoreFile), cKeystorePass);

} else

objpbeKey = (SecretKey) objKeystore.getKey(stKeyAlias, cKeyPass);

And i have error this ...
500 Internal Server Error
java.lang.SecurityException: The JCE framework is invalid
at com.sun.crypto.provider.SunJCE.b(DashoA6275)
at com.sun.crypto.provider.SunJCE.a(DashoA6275)
at com.sun.crypto.provider.PBEKeyFactory.<init>(DashoA6275)
at java.lang.Class.newInstance0(Native Method)
at java.lang.Class.newInstance(
at javax.crypto.SunJCE_b.a(DashoA6275)
at javax.crypto.SunJCE_b.a(DashoA6275)
at javax.crypto.SecretKeyFactory.getInstance(DashoA6275)
at acc.itparameter.sys004.controller.Crypt.<init>(Unknown Source)
at _pages._admin__light._main._Login._jspService(
at com.orionserver[Oracle9iAS ( Containers for J2EE].http.OrionHttpJspPage.service(
at oracle.jsp.runtimev2.JspPageTable.compileAndServe(
at oracle.jsp.runtimev2.JspPageTable.service(
at oracle.jsp.runtimev2.JspServlet.internalService(
at oracle.jsp.runtimev2.JspServlet.service(
at javax.servlet.http.HttpServlet.service(
at com.evermind[Oracle9iAS ( Containers for J2EE].server.http.ServletRequestDispatcher.invoke(
at com.evermind[Oracle9iAS ( Containers for J2EE].server.http.ServletRequestDispatcher.forwardInternal(
at com.evermind[Oracle9iAS ( Containers for J2EE].server.http.HttpRequestHandler.processRequest(
at com.evermind[Oracle9iAS ( Containers for J2EE]
at com.evermind[Oracle9iAS ( Containers for J2EE]
at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$
Can you help me please
Run away! Run away! Here, take this tiny ad with you:
Java file APIs (DOC, XLS, PDF, and many more)
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!