Add migrated to .NET 8.0 variant of Hcs.Client

This commit is contained in:
2025-09-26 19:48:32 +09:00
parent da127df8f6
commit 6cd2fb82e9
503 changed files with 223796 additions and 0 deletions

View File

@ -0,0 +1,58 @@
using GostCryptography.Properties;
namespace GostCryptography.Asn1.Ber
{
public class Asn1DiscreteCharSet : Asn1CharSet
{
private readonly int[] _charSet;
public Asn1DiscreteCharSet(string charSet)
: base(charSet.Length)
{
_charSet = new int[charSet.Length];
for (var i = 0; i < _charSet.Length; i++)
{
_charSet[i] = charSet[i];
}
}
public Asn1DiscreteCharSet(int[] charSet)
: base(charSet.Length)
{
_charSet = charSet;
}
public override int MaxValue
{
get { return _charSet[_charSet.Length - 1]; }
}
public override int GetCharAtIndex(int index)
{
if (index >= _charSet.Length)
{
throw ExceptionUtility.CryptographicException(Resources.Asn1ConsVioException, "Character index", index);
}
return _charSet[index];
}
public override int GetCharIndex(int charValue)
{
var index = 0;
while ((index < _charSet.Length) && (_charSet[index] != charValue))
{
index++;
}
if (index >= _charSet.Length)
{
throw ExceptionUtility.CryptographicException(Resources.Asn1ConsVioException, "Character index", charValue);
}
return index;
}
}
}