summary refs log tree commit diff
path: root/crypto/src/tls/NameType.cs
blob: f2e8ec6b6e96bc4b0113304d9d74f72bacf35394 (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
using System;

namespace Org.BouncyCastle.Tls
{
    public abstract class NameType
    {
        /*
         * RFC 3546 3.1.
         */
        public const short host_name = 0;

        public static string GetName(short nameType)
        {
            switch (nameType)
            {
            case host_name:
                return "host_name";
            default:
                return "UNKNOWN";
            }
        }

        public static string GetText(short nameType)
        {
            return GetName(nameType) + "(" + nameType + ")";
        }

        public static bool IsRecognized(short nameType)
        {
            return host_name == nameType;
        }

        public static bool IsValid(short nameType)
        {
            return TlsUtilities.IsValidUint8(nameType);
        }
    }
}