/** * Constructs a new big endian SIC seekable block cipher mode. * * @param cipher The underlying block cipher to use. */ public SICSeekableBlockCipher(final BlockCipher cipher) { this.cipher = cipher; this.blockSize = cipher.getBlockSize(); this.IV = new byte[blockSize]; this.cipherIn = new byte[blockSize]; this.cipherOut = new byte[blockSize]; }
@Override public int getBlockSize() { assert this.blockSize == this.cipher.getBlockSize(); return this.blockSize; }
/** * Create a buffered block cipher with, or without, padding. * * @param cipher the underlying block cipher this buffering object wraps. */ public PaddedBlockCipher( BlockCipher cipher) { this.cipher = cipher; buf = new byte[cipher.getBlockSize()]; bufOff = 0; }
/** * create a standard MAC based on a block cipher. This will produce an * authentication code half the length of the block size of the cipher. * * @param cipher the cipher to be used as the basis of the MAC generation. * @deprecated use CBCBlockCipherMac */ public BlockCipherMac( BlockCipher cipher) { this(cipher, (cipher.getBlockSize() * 8) / 2); }
/** * @param cipher base cipher */ public G3413CBCBlockCipher(BlockCipher cipher) { this.blockSize = cipher.getBlockSize(); this.cipher = cipher; }
/** * return the block size we are operating at. * * @return the block size we are operating at (in bytes). */ public int getBlockSize() { return cipher.getBlockSize(); }
/** * return the blocksize for the underlying cipher. * * @return the blocksize for the underlying cipher. */ public int getBlockSize() { return cipher.getBlockSize(); }
/** * create a standard MAC based on a CBC block cipher. This will produce an * authentication code half the length of the block size of the cipher. * * @param cipher the cipher to be used as the basis of the MAC generation. */ public CBCBlockCipherMac( BlockCipher cipher) { this(cipher, (cipher.getBlockSize() * 8) / 2, null); }
/** * return the block size we are operating at. * * @return the block size we are operating at (in bytes). */ public int getBlockSize() { return cipher.getBlockSize(); }
/** * create a standard MAC based on a CFB block cipher. This will produce an * authentication code half the length of the block size of the cipher, with * the CFB mode set to 8 bits. * * @param cipher the cipher to be used as the basis of the MAC generation. */ public CFBBlockCipherMac( BlockCipher cipher) { this(cipher, 8, (cipher.getBlockSize() * 8) / 2, null); }
/** * Create a buffered block cipher with, or without, padding. * * @param cipher the underlying block cipher this buffering object wraps. */ public PaddedBlockCipher( BlockCipher cipher) { this.cipher = cipher; buf = new byte[cipher.getBlockSize()]; bufOff = 0; }
@Override public int getLength() { return cipher.getBlockSize(); } }
/** * @param cipher base cipher */ public G3413OFBBlockCipher(BlockCipher cipher) { super(cipher); this.blockSize = cipher.getBlockSize(); this.cipher = cipher; Y = new byte[blockSize]; }
XTSTweak(BlockCipher cipher, LongFunction<byte[]> tweakFunction, byte[] tweak) { this.cipher = Objects.requireNonNull(cipher); this.tweakFunction = Objects.requireNonNull(tweakFunction); this.tweak = Objects.requireNonNull(tweak); if (cipher.getBlockSize() != BLOCK_SIZE) { throw new IllegalArgumentException("bad block size: " + cipher.getBlockSize()); } }
public KXTSBlockCipher(BlockCipher cipher) { // super(cipher); this.cipher = cipher; this.blockSize = cipher.getBlockSize(); this.reductionPolynomial = getReductionPolynomial(blockSize); this.tw_init = new long[blockSize >>> 3]; this.tw_current = new long[blockSize >>> 3]; this.counter = -1; }
public GCFBBlockCipher(BlockCipher engine) { super(engine); this.cfbEngine = new CFBBlockCipher(engine, engine.getBlockSize() * 8); }
private void CTR_DRBG_Instantiate_algorithm(byte[] entropy, byte[] nonce, byte[] personalisationString) { byte[] seedMaterial = Arrays.concatenate(entropy, nonce, personalisationString); byte[] seed = Block_Cipher_df(seedMaterial, _seedLength); int outlen = _engine.getBlockSize(); _Key = new byte[(_keySizeInBits + 7) / 8]; _V = new byte[outlen]; // _Key & _V are modified by this call CTR_DRBG_Update(seed, _Key, _V); _reseedCounter = 1; }
private void CTR_DRBG_Instantiate_algorithm(byte[] entropy, byte[] nonce, byte[] personalisationString) { byte[] seedMaterial = Arrays.concatenate(entropy, nonce, personalisationString); byte[] seed = Block_Cipher_df(seedMaterial, _seedLength); int outlen = _engine.getBlockSize(); _Key = new byte[(_keySizeInBits + 7) / 8]; _V = new byte[outlen]; // _Key & _V are modified by this call CTR_DRBG_Update(seed, _Key, _V); _reseedCounter = 1; }
private void initCipher(boolean forEncryption, BlockCipher cipher, byte[] key_block, int key_size, int key_offset, int iv_offset) { KeyParameter key_parameter = new KeyParameter(key_block, key_offset, key_size); ParametersWithIV parameters_with_iv = new ParametersWithIV(key_parameter, key_block, iv_offset, cipher.getBlockSize()); cipher.init(forEncryption, parameters_with_iv); }
public KGCMBlockCipher(BlockCipher dstu7624Engine) { this.engine = dstu7624Engine; this.ctrEngine = new BufferedBlockCipher(new KCTRBlockCipher(this.engine)); this.macSize = -1; this.blockSize = engine.getBlockSize(); this.initialAssociatedText = new byte[blockSize]; this.iv = new byte[blockSize]; this.multiplier = createDefaultMultiplier(blockSize); this.b = new long[blockSize >>> 3]; this.macBlock = null; }