⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 bufferedasymmetricblockcipher.java

📁 java 文件下载器。可自定义
💻 JAVA
字号:
// Decompiled by Jad v1.5.8e2. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://kpdus.tripod.com/jad.html
// Decompiler options: packimports(3) fieldsfirst ansi space 
// Source File Name:   BufferedAsymmetricBlockCipher.java

package org.bouncycastle.crypto;


// Referenced classes of package org.bouncycastle.crypto:
//			AsymmetricBlockCipher, DataLengthException, InvalidCipherTextException, CipherParameters

public class BufferedAsymmetricBlockCipher
{

	protected byte buf[];
	protected int bufOff;
	private boolean forEncryption;
	private AsymmetricBlockCipher cipher;

	public BufferedAsymmetricBlockCipher(AsymmetricBlockCipher cipher)
	{
		this.cipher = cipher;
	}

	public AsymmetricBlockCipher getUnderlyingCipher()
	{
		return cipher;
	}

	public int getBufferPosition()
	{
		return bufOff;
	}

	public void init(boolean forEncryption, CipherParameters params)
	{
		this.forEncryption = forEncryption;
		reset();
		cipher.init(forEncryption, params);
		buf = new byte[cipher.getInputBlockSize()];
		bufOff = 0;
	}

	public int getInputBlockSize()
	{
		return cipher.getInputBlockSize();
	}

	public int getOutputBlockSize()
	{
		return cipher.getOutputBlockSize();
	}

	public void processByte(byte in)
	{
		if (bufOff > buf.length)
		{
			throw new DataLengthException("attempt to process message to long for cipher");
		} else
		{
			buf[bufOff++] = in;
			return;
		}
	}

	public void processBytes(byte in[], int inOff, int len)
	{
		if (len == 0)
			return;
		if (len < 0)
			throw new IllegalArgumentException("Can't have a negative input length!");
		if (bufOff + len > buf.length)
		{
			throw new DataLengthException("attempt to process message to long for cipher");
		} else
		{
			System.arraycopy(in, inOff, buf, bufOff, len);
			bufOff += len;
			return;
		}
	}

	public byte[] doFinal()
		throws InvalidCipherTextException
	{
		byte out[] = cipher.processBlock(buf, 0, bufOff);
		reset();
		return out;
	}

	public void reset()
	{
		if (buf != null)
		{
			for (int i = 0; i < buf.length; i++)
				buf[0] = 0;

		}
		bufOff = 0;
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -