INNER CODE UNIT · C#

finalBlockLength

sdrapkin/SecurityDriven.Inferno · EtM_CBC.cs:54

			int finalBlockLength = plaintext.Count % Cipher.AesConstants.AES_BLOCK_SIZE;
			int paddingLength = Cipher.AesConstants.AES_BLOCK_SIZE - finalBlockLength;
			int ciphertextLength = CONTEXT_BUFFER_LENGTH + plaintext.Count + paddingLength + MAC_LENGTH;
			if (output.Length - outputOffset < ciphertextLength) throw new ArgumentOutOfRangeException(nameof(output), $"'{nameof(output)}' array segment is not big enough for the ciphertext");

			try
			{
				var iv = _iv.Value;
				var contextBuffer = _contextBuffer.Value;
				var encKey = _encKey.Value;
				var macKey = _macKey.Value;
				var sessionKey = _sessionKey.Value;

				using (var aes = _aesFactory())
				{
					EtM_CBC.ValidateAes(aes);
					_cryptoRandom.NextBytes(contextBuffer, 0, CONTEXT_BUFFER_LENGTH);

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…