Twofish keygenerator not available error

459 Views Asked by At

I'm working on Twofish encryption and worked on something like the code below.
However, I have been getting the above stated error.
Kindly help look into it and advice as necessary.

SecureRandom sr= new SecureRandom(cipher_key.getBytes());
      KeyGenerator kg=KeyGenerator.getInstance("twofish");
      kg.init(sr);
      SecretKey sk = kg.generateKey();
      // create an instance of cipher
        Cipher cipher = Cipher.getInstance("twofish");

        // initialize the cipher with the key
        cipher.init(Cipher.ENCRYPT_MODE, sk);

        // enctypt!
        encrypted = cipher.doFinal(word.getBytes());
0

There are 0 best solutions below