public String getAlgorithmName() { return cipher.getAlgorithmName(); }
public void update( byte in) { if (bufOff == buf.length) { cipher.processBlock(buf, 0, mac, 0); bufOff = 0; } buf[bufOff++] = in; }
/** * Reset the mac generator. */ public void reset() { /* * clean the buffer. */ for (int i = 0; i < buf.length; i++) { buf[i] = 0; } bufOff = 0; /* * reset the underlying cipher. */ cipher.reset(); } }
public int doFinal( byte[] out, int outOff) { int blockSize = cipher.getBlockSize(); // // pad with zeroes // if (this.padding == null) { while (bufOff < blockSize) { buf[bufOff] = 0; bufOff++; } } else { padding.addPadding(buf, bufOff); } cipher.processBlock(buf, 0, mac, 0); cipher.getMacBlock(mac); System.arraycopy(mac, 0, out, outOff, macSize); reset(); return macSize; }
public void update( byte[] in, int inOff, int len) { if (len < 0) { throw new IllegalArgumentException("Can't have a negative input length!"); } int blockSize = cipher.getBlockSize(); int resultLen = 0; int gapLen = blockSize - bufOff; if (len > gapLen) { System.arraycopy(in, inOff, buf, bufOff, gapLen); resultLen += cipher.processBlock(buf, 0, mac, 0); bufOff = 0; len -= gapLen; inOff += gapLen; while (len > blockSize) { resultLen += cipher.processBlock(in, inOff, mac, 0); len -= blockSize; inOff += blockSize; } } System.arraycopy(in, inOff, buf, bufOff, len); bufOff += len; }
this.cipher = new MacCFBBlockCipher(cipher, cfbBitSize); this.padding = padding; this.macSize = macSizeInBits / 8; buf = new byte[this.cipher.getBlockSize()]; bufOff = 0;
public void init( CipherParameters params) { reset(); cipher.init(params); }
public int doFinal( byte[] out, int outOff) { int blockSize = cipher.getBlockSize(); // // pad with zeroes // if (this.padding == null) { while (bufOff < blockSize) { buf[bufOff] = 0; bufOff++; } } else { padding.addPadding(buf, bufOff); } cipher.processBlock(buf, 0, mac, 0); cipher.getMacBlock(mac); System.arraycopy(mac, 0, out, outOff, macSize); reset(); return macSize; }
public void update( byte[] in, int inOff, int len) { if (len < 0) { throw new IllegalArgumentException("Can't have a negative input length!"); } int blockSize = cipher.getBlockSize(); int resultLen = 0; int gapLen = blockSize - bufOff; if (len > gapLen) { System.arraycopy(in, inOff, buf, bufOff, gapLen); resultLen += cipher.processBlock(buf, 0, mac, 0); bufOff = 0; len -= gapLen; inOff += gapLen; while (len > blockSize) { resultLen += cipher.processBlock(in, inOff, mac, 0); len -= blockSize; inOff += blockSize; } } System.arraycopy(in, inOff, buf, bufOff, len); bufOff += len; }
this.cipher = new MacCFBBlockCipher(cipher, cfbBitSize); this.padding = padding; this.macSize = macSizeInBits / 8; buf = new byte[this.cipher.getBlockSize()]; bufOff = 0;
public void init( CipherParameters params) { reset(); cipher.init(params); }
/** * Reset the mac generator. */ public void reset() { /* * clean the buffer. */ for (int i = 0; i < buf.length; i++) { buf[i] = 0; } bufOff = 0; /* * reset the underlying cipher. */ cipher.reset(); } }
public void update( byte in) { if (bufOff == buf.length) { cipher.processBlock(buf, 0, mac, 0); bufOff = 0; } buf[bufOff++] = in; }
public String getAlgorithmName() { return cipher.getAlgorithmName(); }