SetBufferSize() public method

public SetBufferSize ( int bufferSize ) : void
bufferSize int
return void
		public void TestSha1WithRsaEncapsulatedBuffered()
		{
			MemoryStream bOut = new MemoryStream();

            IX509Store x509Certs = CmsTestUtil.MakeCertStore(OrigCert, SignCert);

			//
			// find unbuffered length
			//
			CmsSignedDataStreamGenerator gen = new CmsSignedDataStreamGenerator();
			gen.AddSigner(OrigKP.Private, OrigCert, CmsSignedDataStreamGenerator.DigestSha1);
			gen.AddCertificates(x509Certs);

			Stream sigOut = gen.Open(bOut, true);

			for (int i = 0; i != 2000; i++)
			{
				sigOut.WriteByte((byte)(i & 0xff));
			}

			sigOut.Close();

			CmsSignedDataParser sp = new CmsSignedDataParser(bOut.ToArray());

			sp.GetSignedContent().Drain();

			VerifySignatures(sp);

			int unbufferedLength = bOut.ToArray().Length;

			//
			// find buffered length - buffer size less than default
			//
			bOut.SetLength(0);

			gen = new CmsSignedDataStreamGenerator();
			gen.SetBufferSize(300);
            gen.AddSigner(OrigKP.Private, OrigCert, CmsSignedDataStreamGenerator.DigestSha1);
			gen.AddCertificates(x509Certs);

            sigOut = gen.Open(bOut, true);

			for (int i = 0; i != 2000; i++)
			{
				sigOut.WriteByte((byte)(i & 0xff));
			}

			sigOut.Close();

			VerifyEncodedData(bOut);

			Assert.IsTrue(unbufferedLength < bOut.ToArray().Length);
		}