import java.security.SecureRandom;
/**
* 用于RSA非对称密钥运算时,运算数据的是填充
* @author lvLiang
* @Aug 31, 2010 4:47:23 PM
* @version 1.00
*/
public class PKCS1Encoding {
private static final int HEADER_LENGTH = 10;
private SecureRandom random;
private int bitSize;
private boolean forEncryption;
private boolean forPrivateKey;
private int inblockSize;
private int outblockSize;
/**
*
* @param modulus RSA 密钥的模长
* @param forEncryption true加密填充 false 解密填充
* @param forPrivateKey true私钥 false公钥
*/
public PKCS1Encoding(int modulus,boolean forEncryption,boolean forPrivateKey) {
bitSize = modulus;
this.random = new SecureRandom();
this.forPrivateKey = forPrivateKey;
this.forEncryption = forEncryption;
if(forEncryption){
inblock