new CFBBlockCipher(cipher.getUnderlyingCipher(), 8 * cipher.getBlockSize()));
new CFBBlockCipher(baseEngine, 8 * baseEngine.getBlockSize()));
    protected void engineSetMode(        String  mode)        throws NoSuchAlgorithmException    {        modeName = mode.toUpperCase();        if (modeName.equals("ECB"))        {            ivLength = 0;            cipher = new PaddedBufferedBlockCipher(cipher.getUnderlyingCipher());        }        else if (modeName.equals("CBC"))        {            ivLength = cipher.getUnderlyingCipher().getBlockSize();            cipher = new PaddedBufferedBlockCipher(                            new CBCBlockCipher(cipher.getUnderlyingCipher()));        }        else if (modeName.startsWith("OFB"))        {            ivLength = cipher.getUnderlyingCipher().getBlockSize();            if (modeName.length() != 3)            {                int wordSize = Integer.parseInt(modeName.substring(3));                cipher = new PaddedBufferedBlockCipher(                                new OFBBlockCipher(cipher.getUnderlyingCipher(), wordSize));            }            else            {                cipher = new PaddedBufferedBlockCipher(                        new OFBBlockCipher(cipher.getUnderlyingCipher(), 8 * cipher.getBlockSize()));            }        }        else if (modeName.startsWith("CFB"))        {            ivLength = cipher.getUnderlyingCipher().getBlockSize();            if (modeName.length() != 3)            {                int wordSize = Integer.parseInt(modeName.substring(3));                cipher = new PaddedBufferedBlockCipher(                                new CFBBlockCipher(cipher.getUnderlyingCipher(), wordSize));            }            else            {                cipher = new PaddedBufferedBlockCipher(                        new CFBBlockCipher(cipher.getUnderlyingCipher(), 8 * cipher.getBlockSize()));            }        }        else if (modeName.startsWith("PGP"))        {            if (modeName.equalsIgnoreCase("PGPCFBwithIV"))            {                ivLength = cipher.getUnderlyingCipher().getBlockSize();                cipher = new PaddedBufferedBlockCipher(                    new PGPCFBBlockCipher(cipher.getUnderlyingCipher(), true));            }            else            {                ivLength = cipher.getUnderlyingCipher().getBlockSize();                cipher = new PaddedBufferedBlockCipher(                    new PGPCFBBlockCipher(cipher.getUnderlyingCipher(), false));            }        }        else if (modeName.equalsIgnoreCase("OpenPGPCFB"))        {            ivLength = 0;            cipher = new PaddedBufferedBlockCipher(                new OpenPGPCFBBlockCipher(cipher.getUnderlyingCipher()));        }        else if (modeName.startsWith("SIC"))        {            ivLength = cipher.getUnderlyingCipher().getBlockSize();            if (ivLength < 16)            {                throw new IllegalArgumentException("Warning: SIC-Mode can become a twotime-pad if the blocksize of the cipher is too small. Use a cipher with a block size of at least 128 bits (e.g. AES)");            }            cipher = new BufferedBlockCipher(                        new SICBlockCipher(cipher.getUnderlyingCipher()));        }        else if (modeName.startsWith("CTR"))        {            ivLength = cipher.getUnderlyingCipher().getBlockSize();            cipher = new BufferedBlockCipher(                        new SICBlockCipher(cipher.getUnderlyingCipher()));        }        else if (modeName.startsWith("GOFB"))        {            ivLength = cipher.getUnderlyingCipher().getBlockSize();            cipher = new BufferedBlockCipher(                        new GOFBBlockCipher(cipher.getUnderlyingCipher()));        }        else if (modeName.startsWith("CTS"))        {            ivLength = cipher.getUnderlyingCipher().getBlockSize();            cipher = new CTSBlockCipher(new CBCBlockCipher(cipher.getUnderlyingCipher()));        }        else        {            throw new NoSuchAlgorithmException("can't support mode " + mode);        }    }