Twofish keygenerator无法使用错误

时间:2016-07-30 03:41:50

标签: java twofish

我正在进行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());

0 个答案:

没有答案