summary refs log tree commit diff
path: root/crypto/src/crypto/tls/TlsNullCipher.cs
blob: 3e2bfa8475fa70e811ec98f5e471009a6797dc46 (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(byte type, byte[] plaintext, int offset, int len)
        {
            return CopyData(plaintext, offset, len);
        }

        public virtual byte[] DecodeCiphertext(byte 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;
        }
    }
}