/
diev
/
PKISolutions-Asn1DerParser.NET
Обзор
Документация
Войти
/
diev
/
PKISolutions-Asn1DerParser.NET
Код
Запросы
0
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
master
Asn1Parser/Utils/StringUtils.cs
24 строки
993 B
Vadims Podāns
file-scoped namespaces
23 фев 2023, 16:54
23 фев 2023, 16:54
7bd1793
Код
Авторство
О чём код?
using System; using System.Collections.Generic; namespace SysadminsLV.Asn1Parser.Utils; static class StringUtils { public static List<Byte> GetAlphabet(Asn1Type type) { switch (type) { case Asn1Type.PrintableString: return generatePrintableStringAlphabet(); } throw new ArgumentException("Invalid string type is specified."); } static List<Byte> generatePrintableStringAlphabet() { List<Byte> allowed = new List<Byte> { 32 }; for (Byte index = 0x30; index <= 0x39; index++) { allowed.Add(index); } for (Byte index = 0x41; index <= 0x5a; index++) { allowed.Add(index); } for (Byte index = 0x61; index <= 0x7a; index++) { allowed.Add(index); } for (Byte index = 0x27; index <= 0x29; index++) { allowed.Add(index); } for (Byte index = 0x2b; index <= 0x2f; index++) { allowed.Add(index); } allowed.AddRange(new Byte[] { 0x3a, 0x3d, 0x3f }); return allowed; } }