Hello,

I'm trying to use the

  org.jboss.test.security.interceptors.ClientEncryptionInterceptor
  org.jboss.test.security.interceptors.ServerEncryptionInterceptor

but I'm having some problems.. .

I get an exception 

 ?private void initCipher(Subject subject) throws GeneralSecurityException?

First I was getting an GeneralSecurityException on

  if( key == null )
      {
         System.out.println("Subject: "+subject);
         throw new GeneralSecurityException("Failed to find SecretKey in 
Subject.PrivateCredentials");
      }

[ClientEncryptionInterceptor.java]


I guessed that I had to specify a cipherAlgorithm when I was creating the 
VerifierInfo on my VerifierStore. So I tried specifying a cipherAlgorithm?

       public void addUser(String username, char[] password)
   {
      VerifierInfo info = new VerifierInfo();
      info.username = username;
     
   //   info.cipherAlgorithm="PBEWithMD5AndDES";
      info.cipherAlgorithm="DES";
      
      // Create a random salt
      long r = Util.nextLong();
      String rs = Long.toHexString(r);
      info.salt = rs.getBytes();
      BigInteger g = SRPConf.getDefaultParams().g();
      BigInteger N = SRPConf.getDefaultParams().N();

      info.verifier = Util.calculateVerifier(username, password, info.salt, N, 
g);
      info.g = g.toByteArray();
      info.N = N.toByteArray();


      log.info("Added user: "+username);
      storeMap.put(username, info);
      
   }

 [VerifierStore.java]

I get an Exception with both (PBEWithMD5AndDES and DES) always  on


  encryptCipher.init(Cipher.ENCRYPT_MODE, key, iv); 

[ClientEncryptionInterceptor.java]

With PBEWithMD5AndDES I get:

java.lang.ClassCastException
        at com.sun.crypto.provider.SunJCE_ab.a(DashoA6275)
        at com.sun.crypto.provider.PBEWithMD5AndDESCipher.engineInit(DashoA6275)
        at javax.crypto.Cipher.init(DashoA6275)

With DES I get:

InvalidKeyException.. Invalid key length: 40 bytes
  
  

I think my VerifierInfo must be initialized acording with the cipherAlgorithm 
or maybe doing something else wrong...

I appreciate any help...


View the original post : 
http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3860903#3860903

Reply to the post : 
http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3860903


-------------------------------------------------------
The SF.Net email is sponsored by: Beat the post-holiday blues
Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek.
It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt
_______________________________________________
JBoss-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to