public ConvertInput ( byte inBuf, int inOff, int inLen ) : |
||
inBuf | byte | |
inOff | int | |
inLen | int | |
return |
public BigInteger ConvertInput(
byte[] inBuf,
int inOff,
int inLen)
{
int maxLength = (bitSize + 7) / 8;
if (inLen > maxLength)
throw new DataLengthException("input too large for RSA cipher.");
BigInteger input = new BigInteger(1, inBuf, inOff, inLen);
if (input.CompareTo(key.Modulus) >= 0)
throw new DataLengthException("input too large for RSA cipher.");
return input;
}
/** * Process a single block using the basic RSA algorithm. * * @param inBuf the input array. * @param inOff the offset into the input buffer where the data starts. * @param inLen the length of the data to be processed. * @return the result of the RSA process. * @exception DataLengthException the input block is too large. */ public byte[] ProcessBlock( byte[] inBuf, int inOff, int inLen) { if (core == null) { throw new InvalidOperationException("RSA engine not initialised"); } return(core.ConvertOutput(core.ProcessBlock(core.ConvertInput(inBuf, inOff, inLen)))); }