0 Replies Latest reply on Nov 15, 2010 11:37 AM by Jonathan Hawkins

    Unable to retrieve SecretKeyEntry

    Jonathan Hawkins Newbie

      I'm using JBoss_4_2_3 on IBM AIX using IBM JDK pap6460sr8fp1-20100624_01 (SR8 FP1).


      If I run a test class from a command line on this environment I am able to retrieve a SecretKeyEntry without any problem. Howver, if I try the same operation from within a war file deployed in JBoss I am unable to retrieve the SecretKeyEntry. I have compared obvious variables such as classpath, library path etc...


      I have searched the server log and can find no exceptions being generated within the Jboss container, this is all that I see


      2010-11-15 14:30:54,792 INFO  [STDOUT] AESEncryption(setKey) - Found Alias aeskey
      2010-11-15 14:30:54,794 INFO  [STDOUT] AESEncryption(setKey) - skEntry has evaluated to null
      2010-11-15 14:30:55,478 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost].[/encryptionTest].[jsp]] Servlet.service() for servlet jsp threw exception
      at com.coa.encryption.aes.AESEncryption.setKey(AESEncryption.java:336)


      The code snippet is


      KeyStore.SecretKeyEntry skEntry =

      new KeyStore.SecretKeyEntry(new SecretKeySpec(sKeyPassword.getBytes(), "JCEKS"));

      skEntry = (SecretKeyEntry) keyStore.getEntry(sKeyAlias,

      new KeyStore.PasswordProtection(passwd));



      if (skEntry == null) {


      "AESEncryption(setKey) - skEntry has evaluated to null");


      aesKey = skEntry.getSecretKey();


      This code works fine when ivoked from the command line using


      java -jar coa-encryption.jar /home/efin/JBossFPM/JBoss_4_2_3/COASolutions.jce ABS:250


      However, if using in JBoss from a jsp page





      String[] args =




      args[0] =




      args[1] =








      I get the problem


      Any assistance would be greatly appreciated.