diff options
Diffstat (limited to 'crypto/src/tls/NameType.cs')
-rw-r--r-- | crypto/src/tls/NameType.cs | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/crypto/src/tls/NameType.cs b/crypto/src/tls/NameType.cs new file mode 100644 index 000000000..f2e8ec6b6 --- /dev/null +++ b/crypto/src/tls/NameType.cs @@ -0,0 +1,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); + } + } +} |