summary refs log tree commit diff
path: root/Crypto/src/crypto/tls/TlsNullCipher.cs
blob: b76f76d9c35cfdfb94ed0096f192cb0dc8fe96fa (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
using System;

namespace Org.BouncyCastle.Crypto.Tls
{
	/// <summary>
	/// A NULL cipher suite, for use during handshake.
	/// </summary>
	public class TlsNullCipher
		: TlsCipher
	{
		public virtual byte[] EncodePlaintext(ContentType type, byte[] plaintext, int offset, int len)
		{
			return CopyData(plaintext, offset, len);
		}

        public virtual byte[] DecodeCiphertext(ContentType type, byte[] ciphertext, int offset, int len)
		{
			return CopyData(ciphertext, offset, len);
		}

		protected virtual byte[] CopyData(byte[] text, int offset, int len)
		{
			byte[] result = new byte[len];
			Array.Copy(text, offset, result, 0, len);
			return result;
		}
	}
}