1 Reply Latest reply on Mar 21, 2003 1:48 PM by 843810

    Blowfish Key Question

    843810
      Hello,

      I am playing around with the crypto packages, and have run into a problem that I can't quite figure out.


      KeyGenerator kg = KeyGenerator.getInstance(cryptoMethod);
      kg.init(448);
      SecretKey genKey = kg.generateKey();
      sKeySpec = new SecretKeySpec(passPhrase.getBytes("UTF-8"), cryptoMethod);

      Here, I create a SecretKeySpec... if passPhrase.getBytes() > 16, I get this exception:

      java.lang.SecurityException: Unsupported keysize or algorithm parameters
           at javax.crypto.Cipher.init(DashoA6275)

      If it's passPhrase.getBytes() <= 16, it works just fine (encryption/decryption and all).

      cryptoMethod is currently "Blowfish", of course.

      Am I missing something here?

      Thank you for your time!