/** * Create a buffered block cipher without padding. * * @param cipher the underlying block cipher this buffering object wraps. * @param padded true if the buffer should add, or remove, pad bytes, * false otherwise. */ public BufferedBlockCipher( BlockCipher cipher) { this.cipher = cipher; buf = new byte[cipher.getBlockSize()]; bufOff = 0; // // check if we can handle partial blocks on doFinal. // String name = cipher.getAlgorithmName(); int idx = name.IndexOf('/') + 1; pgpCFB = (idx > 0 && name.Substring(idx).StartsWith("PGP")); if (pgpCFB) { partialBlockOkay = true; } else { partialBlockOkay = (idx > 0 && (name.Substring(idx).StartsWith("CFB") || name.Substring(idx).StartsWith("OFB"))); } }
/** * return the algorithm name and mode. * * @return the name of the underlying algorithm followed by "/CBC". */ public String getAlgorithmName() { return(cipher.getAlgorithmName() + "/CBC"); }
/** * return the algorithm name and mode. * * @return the name of the underlying algorithm followed by "/CFB" * and the block size in bits. */ public String getAlgorithmName() { return(cipher.getAlgorithmName() + "/CFB" + (blockSize * 8)); }