0 Replies Latest reply on Dec 3, 2010 7:44 AM by nicolasdavyt1234

    How to encript database password with KeyStore based login module for encrypting  JassSecurityDomain JBoss 5.01

    nicolasdavyt1234

      Hi, I am trying to configure the following steps.

       

      Use the org.jboss.resource.security.JaasSecurityDomainIdentityLoginModule. This is a login module for statically defining a data source using a password that has been encrypted by a JaasSecurityDomain. The base64 format of the data source password may be generated using PBEUtils.


      Changes to be made in the application:

      1.    Create  KeyStore.

      2.    Uses the PBEUtils, with parameters: the plainText password for the KeyStore,  plainText password for Database, salt attribute (must only be eight characters long). and interator count (attribute from the JaasSecurity domain).

      3.    Changing the connection settings database. [File: cms-oracle-ds.xml].

      4.   Changing the configuration login-config.xml.

       

       

      All Password are 8 characters long, when start the server the log write this:

       

       

      javax.crypto.IllegalBlockSizeException: Input length must be multiple of 8 when decrypting with padded cipher
          at com.sun.crypto.provider.SunJCE_f.b(DashoA13*..)
          at com.sun.crypto.provider.SunJCE_f.b(DashoA13*..)
          at com.sun.crypto.provider.SunJCE_ab.b(DashoA13*..)
          at com.sun.crypto.provider.PBEWithMD5AndDESCipher.engineDoFinal(DashoA13*..)
          at javax.crypto.Cipher.doFinal(DashoA13*..)
          at org.jboss.security.plugins.FilePassword.decode(FilePassword.java:143)
          at org.jboss.security.plugins.FilePassword.toCharArray(FilePassword.java:113)
          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:597)
          at org.jboss.security.Util.invokePasswordClass(Util.java:157)
          at org.jboss.security.Util.loadPassword(Util.java:92)
          at org.jboss.security.plugins.JaasSecurityDomain.setKeyStorePass(JaasSecurityDomain.java:274)
          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:597)
          at org.jboss.mx.interceptor.AttributeDispatcher.invoke(AttributeDispatcher.java:136)
          at org.jboss.mx.server.Invocation.dispatch(Invocation.java:96)
          at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
          at org.jboss.mx.interceptor.ModelMBeanAttributeInterceptor.invoke(ModelMBeanAttributeInterceptor.java:103)
          at org.jboss.mx.interceptor.PersistenceInterceptor.invoke(PersistenceInterceptor.java:76)
          at org.jboss.mx.server.Invocation.invoke(Invocation.java:90)
          at org.jboss.mx.server.AbstractMBeanInvoker.setAttribute(AbstractMBeanInvoker.java:461)
          at org.jboss.mx.server.MBeanServerImpl.setAttribute(MBeanServerImpl.java:617)
          at org.jboss.system.ServiceConfigurator.configure(ServiceConfigurator.java:166)
          at org.jboss.system.ServiceConfigurator.configure(ServiceConfigurator.java:114)

       

      Thkz

      Nicolás Davyt