public CipherParameters decrypt(byte[] in,int inOff,int inLen,int keyLen) throws IllegalArgumentException {
  if (!key.isPrivate()) {
    throw new IllegalArgumentException("Private key required for decryption");
  }
  BigInteger n=key.getModulus();
  BigInteger d=key.getExponent();
  byte[] C=new byte[inLen];
  System.arraycopy(in,inOff,C,0,C.length);
  BigInteger c=new BigInteger(1,C);
  BigInteger r=c.modPow(d,n);
  return generateKey(n,r,keyLen);
}

public CipherParameters decrypt ( byte [ ] in , int inOff , int inLen , int keyLen ) throws IllegalArgumentException { if ( ! key . isPrivate ( ) ) { throw new IllegalArgumentException ( "Private key required for decryption" ) ; } BigInteger n = key . getModulus ( ) ; BigInteger d = key . getExponent ( ) ; byte [ ] C = new byte [ inLen ] ; System . arraycopy ( in , inOff , C , 0 , C . length ) ; BigInteger c = new BigInteger ( 1 , C ) ; BigInteger r = c . modPow ( d , n ) ; return generateKey ( n , r , keyLen ) ; }
decrypt an encapsulated session key .
