Org.BouncyCastle.Crypto.Engines.NullEngine.Init C# (CSharp) Метод

Init() публичный Метод

public Init ( bool forEncryption, ICipherParameters parameters ) : void
forEncryption bool
parameters ICipherParameters
Результат void
		public void Init(
			bool				forEncryption,
			ICipherParameters	parameters)
		{
			// we don't mind any parameters that may come in
			initialised = true;
		}

Usage Example

Пример #1
0
		public override void PerformTest()
		{
			base.PerformTest();

			IBlockCipher engine = new NullEngine();

			engine.Init(true, null);

			byte[] buf = new byte[1];

			engine.ProcessBlock(buf, 0, buf, 0);

			if (buf[0] != 0)
			{
				Fail("NullCipher changed data!");
			}

			byte[] shortBuf = new byte[0];

			try
			{
				engine.ProcessBlock(shortBuf, 0, buf, 0);

				Fail("failed short input check");
			}
			catch (DataLengthException)
			{
				// expected
			}

			try
			{
				engine.ProcessBlock(buf, 0, shortBuf, 0);

				Fail("failed short output check");
			}
			catch (DataLengthException)
			{
				// expected
			}
		}