我正在进行Twofish加密,并且开发了类似下面代码的内容 但是,我收到了上述错误 如有必要,请帮助调查和建议。
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());