summary refs log tree commit diff
path: root/crypto/src/asn1/DerNull.cs
blob: 1ee374db42ea0f78da28824399c6721a110aff37 (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
29
30
31
32
33
34
35
36
37
38
39
using System;

namespace Org.BouncyCastle.Asn1
{
	/**
	 * A Null object.
	 */
	public class DerNull
		: Asn1Null
	{
		public static readonly DerNull Instance = new DerNull();

		private static readonly byte[] ZeroBytes = new byte[0];

		protected internal DerNull()
		{
		}

        internal override int EncodedLength(bool withID)
        {
            return Asn1OutputStream.GetLengthOfEncodingDL(withID, 0);
        }

        internal override void Encode(Asn1OutputStream asn1Out, bool withID)
		{
            asn1Out.WriteEncodingDL(withID, Asn1Tags.Null, ZeroBytes);
        }

        protected override bool Asn1Equals(Asn1Object asn1Object)
		{
			return asn1Object is DerNull;
		}

		protected override int Asn1GetHashCode()
		{
			return -1;
		}
	}
}