protected BaseBlockCipher( BlockCipherProvider provider) { baseEngine = provider.get(); engineProvider = provider; cipher = new BufferedGenericBlockCipher(provider.get()); }
protected BaseBlockCipher( BlockCipher engine) { baseEngine = engine; cipher = new BufferedGenericBlockCipher(engine); }
protected void engineInit( int keySize, SecureRandom random) { super.engineInit(keySize, random); keySizeSet = true; }
protected void engineInit( int opmode, Key key, SecureRandom random) throws InvalidKeyException { try { engineInit(opmode, key, (AlgorithmParameterSpec)null, random); } catch (InvalidAlgorithmParameterException e) { throw new InvalidKeyOrParametersException(e.getMessage(), e); } }
protected BaseBlockCipher( AEADBlockCipher engine, boolean fixedIv, int ivLength) { this.baseEngine = engine.getUnderlyingCipher(); this.fixedIv = fixedIv; this.ivLength = ivLength; this.cipher = new AEADGenericBlockCipher(engine); }
protected byte[] engineUpdate( byte[] input, int inputOffset, int inputLen) { if (wrapStream == null) { throw new IllegalStateException("not supported in a wrapping mode"); } wrapStream.write(input, inputOffset, inputLen); return null; }
protected int engineGetOutputSize( int inputLen) { return cipher.getOutputSize(inputLen); }
protected void engineUpdateAAD(byte[] input, int offset, int length) { cipher.updateAAD(input, offset, length); }
protected AlgorithmParameterSpec engineGetParameterSpec( Class paramSpec) throws InvalidParameterSpecException { if (paramSpec == null) { throw new NullPointerException("argument to getParameterSpec must not be null"); } return localEngineGetParameterSpec(paramSpec); }
protected void engineUpdateAAD(ByteBuffer bytebuffer) { int offset = bytebuffer.arrayOffset() + bytebuffer.position(); int length = bytebuffer.limit() - bytebuffer.position(); engineUpdateAAD(bytebuffer.array(), offset, length); }
protected byte[] engineDoFinal() { byte[] out = new byte[engineGetMacLength()]; macEngine.doFinal(out, 0); return out; }
protected byte[] engineDoFinal( byte[] input, int inputOffset, int inputLen) { if (inputLen != 0) { byte[] out = engineUpdate(input, inputOffset, inputLen); cipher.reset(); return out; } cipher.reset(); return new byte[0]; }
public void erase() { Arrays.fill(this.buf, (byte)0); reset(); } }
protected SecretKey engineGenerateSecret( KeySpec keySpec) throws InvalidKeySpecException { if (keySpec instanceof DESedeKeySpec) { DESedeKeySpec desKeySpec = (DESedeKeySpec)keySpec; return new SecretKeySpec(desKeySpec.getKey(), "DESede"); } return super.engineGenerateSecret(keySpec); } }
protected BaseBlockCipher( org.bouncycastle.crypto.BlockCipher engine, boolean fixedIv, int ivLength) { baseEngine = engine; this.fixedIv = fixedIv; this.cipher = new BufferedGenericBlockCipher(engine); this.ivLength = ivLength / 8; }
protected BaseBlockCipher( AEADBlockCipher engine) { this.baseEngine = engine.getUnderlyingCipher(); this.ivLength = baseEngine.getBlockSize(); this.cipher = new AEADGenericBlockCipher(engine); }
protected int engineUpdate( byte[] input, int inputOffset, int inputLen, byte[] output, int outputOffset) throws ShortBufferException { if (wrapStream == null) { throw new IllegalStateException("not supported in a wrapping mode"); } wrapStream.write(input, inputOffset, inputLen); return 0; }
protected void engineInit( int keySize, SecureRandom random) { super.engineInit(keySize, random); }
protected BaseBlockCipher( BlockCipher engine, int scheme, int digest, int keySizeInBits, int ivLength) { baseEngine = engine; this.scheme = scheme; this.digest = digest; this.keySizeInBits = keySizeInBits; this.ivLength = ivLength; cipher = new BufferedGenericBlockCipher(engine); }
protected BaseBlockCipher( BufferedBlockCipher engine, boolean fixedIv, int ivLength) { baseEngine = engine.getUnderlyingCipher(); this.cipher = new BufferedGenericBlockCipher(engine); this.fixedIv = fixedIv; this.ivLength = ivLength / 8; }