Org.BouncyCastle.Crypto.Engines.AesEngine.GetBlockSize C# (CSharp) Метод

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

public GetBlockSize ( ) : int
Результат int
		public int GetBlockSize()
		{
			return BLOCK_SIZE;
		}

Usage Example

Пример #1
0
		private static void TestRijndael()
		{
			// Test vector (official ECB test vector #356)
			byte[] pbIV = new byte[16];
			byte[] pbTestKey = new byte[32];
			byte[] pbTestData = new byte[16];
			byte[] pbReferenceCT = new byte[16] {
				0x75, 0xD1, 0x1B, 0x0E, 0x3A, 0x68, 0xC4, 0x22,
				0x3D, 0x88, 0xDB, 0xF0, 0x17, 0x97, 0x7D, 0xD7 };
			int i;

			for(i = 0; i < 16; ++i) pbIV[i] = 0;
			for(i = 0; i < 32; ++i) pbTestKey[i] = 0;
			for(i = 0; i < 16; ++i) pbTestData[i] = 0;
			pbTestData[0] = 0x04;

#if KeePassUAP
			AesEngine r = new AesEngine();
			r.Init(true, new KeyParameter(pbTestKey));
			if(r.GetBlockSize() != pbTestData.Length)
				throw new SecurityException(KLRes.EncAlgorithmAes + " (BS).");
			r.ProcessBlock(pbTestData, 0, pbTestData, 0);
#else
			RijndaelManaged r = new RijndaelManaged();

			if(r.BlockSize != 128) // AES block size
			{
				Debug.Assert(false);
				r.BlockSize = 128;
			}

			r.IV = pbIV;
			r.KeySize = 256;
			r.Key = pbTestKey;
			r.Mode = CipherMode.ECB;
			ICryptoTransform iCrypt = r.CreateEncryptor();

			iCrypt.TransformBlock(pbTestData, 0, 16, pbTestData, 0);
#endif

			if(!MemUtil.ArraysEqual(pbTestData, pbReferenceCT))
				throw new SecurityException(KLRes.EncAlgorithmAes + ".");
		}
All Usage Examples Of Org.BouncyCastle.Crypto.Engines.AesEngine::GetBlockSize