diff --git a/.editorconfig b/.editorconfig
index cfdb339..bcd4957 100644
--- a/.editorconfig
+++ b/.editorconfig
@@ -12,29 +12,29 @@ charset = utf-8-bom
[*.{cs,vb}]
dotnet_sort_system_directives_first = true
-dotnet_style_qualification_for_field = false:silent
-dotnet_style_qualification_for_property = false:silent
-dotnet_style_qualification_for_method = false:silent
-dotnet_style_qualification_for_event = false:silent
-dotnet_style_predefined_type_for_locals_parameters_members = true:silent
-dotnet_style_predefined_type_for_member_access = true:silent
-dotnet_style_parentheses_in_arithmetic_binary_operators = always_for_clarity:silent
-dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity:silent
-dotnet_style_parentheses_in_other_binary_operators = always_for_clarity:silent
-dotnet_style_parentheses_in_other_operators = never_if_unnecessary:silent
-dotnet_style_require_accessibility_modifiers = for_non_interface_members:silent
+dotnet_style_qualification_for_field = false:none
+dotnet_style_qualification_for_property = false:none
+dotnet_style_qualification_for_method = false:none
+dotnet_style_qualification_for_event = false:none
+dotnet_style_predefined_type_for_locals_parameters_members = true:none
+dotnet_style_predefined_type_for_member_access = true:none
+dotnet_style_parentheses_in_arithmetic_binary_operators = always_for_clarity:none
+dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity:none
+dotnet_style_parentheses_in_other_binary_operators = always_for_clarity:none
+dotnet_style_parentheses_in_other_operators = never_if_unnecessary:none
+dotnet_style_require_accessibility_modifiers = for_non_interface_members:none
dotnet_style_readonly_field = true:suggestion
dotnet_style_object_initializer = true:suggestion
dotnet_style_collection_initializer = true:suggestion
dotnet_style_explicit_tuple_names = true:suggestion
dotnet_style_null_propagation = true:suggestion
dotnet_style_coalesce_expression = true:suggestion
-dotnet_style_prefer_is_null_check_over_reference_equality_method = true:silent
+dotnet_style_prefer_is_null_check_over_reference_equality_method = true:none
dotnet_style_prefer_inferred_tuple_names = true:suggestion
dotnet_style_prefer_inferred_anonymous_type_member_names = true:suggestion
-dotnet_style_prefer_auto_properties = true:silent
-dotnet_style_prefer_conditional_expression_over_assignment = true:silent
-dotnet_style_prefer_conditional_expression_over_return = true:silent
+dotnet_style_prefer_auto_properties = true:none
+dotnet_style_prefer_conditional_expression_over_assignment = true:none
+dotnet_style_prefer_conditional_expression_over_return = true:none
dotnet_naming_style.pascal_case_style.capitalization = pascal_case
dotnet_naming_style.camel_case_style.capitalization = camel_case
dotnet_naming_style.camel_case_underscore_style.capitalization = camel_case
@@ -72,21 +72,21 @@ dotnet_naming_symbols.private_fields.applicable_kinds = field
dotnet_naming_symbols.private_fields.applicable_accessibilities = private
[*.cs]
-csharp_style_var_for_built_in_types = true:silent
-csharp_style_var_when_type_is_apparent = true:silent
-csharp_style_var_elsewhere = true:silent
-csharp_style_expression_bodied_methods = false:silent
-csharp_style_expression_bodied_constructors = false:silent
-csharp_style_expression_bodied_operators = false:silent
-csharp_style_expression_bodied_properties = true:silent
-csharp_style_expression_bodied_indexers = true:silent
-csharp_style_expression_bodied_accessors = true:silent
+csharp_style_var_for_built_in_types = true:none
+csharp_style_var_when_type_is_apparent = true:none
+csharp_style_var_elsewhere = true:none
+csharp_style_expression_bodied_methods = false:none
+csharp_style_expression_bodied_constructors = false:none
+csharp_style_expression_bodied_operators = false:none
+csharp_style_expression_bodied_properties = true:none
+csharp_style_expression_bodied_indexers = true:none
+csharp_style_expression_bodied_accessors = true:none
csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion
csharp_style_pattern_matching_over_as_with_null_check = true:suggestion
csharp_style_throw_expression = true:suggestion
csharp_style_conditional_delegate_call = true:suggestion
csharp_preferred_modifier_order = public,private,protected,internal,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,volatile,async:suggestion
-csharp_prefer_braces = false:silent
+csharp_prefer_braces = false:none
csharp_style_deconstructed_variable_declaration = true:suggestion
csharp_prefer_simple_default_expression = true:suggestion
csharp_style_pattern_local_over_anonymous_function = true:suggestion
@@ -114,6 +114,9 @@ csharp_space_between_method_call_name_and_opening_parenthesis = false
csharp_space_between_method_call_empty_parameter_list_parentheses = false
csharp_preserve_single_line_statements = true
csharp_preserve_single_line_blocks = true
+csharp_style_namespace_declarations = file_scoped
+csharp_using_directive_placement = outside_namespace:none
+csharp_style_prefer_range_operator = false:none
[*.vb]
visual_basic_preferred_modifier_order = Partial,Default,Private,Protected,Public,Friend,NotOverridable,Overridable,MustOverride,Overloads,Overrides,MustInherit,NotInheritable,Static,Shared,Shadows,ReadOnly,WriteOnly,Dim,Const,WithEvents,Widening,Narrowing,Custom,Async:suggestion
diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml
index 81e5eef..9a5a06d 100644
--- a/.github/workflows/dotnet.yml
+++ b/.github/workflows/dotnet.yml
@@ -16,10 +16,10 @@ jobs:
- name: Setup .NET
uses: actions/setup-dotnet@v2
with:
- dotnet-version: 8.0.x
+ dotnet-version: 9.0.x
- name: Restore dependencies
run: dotnet restore
- name: Build
run: dotnet build --no-restore -c Release
- name: Test
- run: dotnet test --no-build --verbosity normal -c Release -f net8.0
+ run: dotnet test --no-build --verbosity normal -c Release -f net9.0
diff --git a/Directory.Build.props b/Directory.Build.props
index 21db88e..384bcf2 100644
--- a/Directory.Build.props
+++ b/Directory.Build.props
@@ -12,13 +12,6 @@
$(MSBuildThisFileDirectory)Key.snk
-
-
- all
- runtime; build; native; contentfiles; analyzers; buildtransitive
-
-
-
diff --git a/benchmarks/OpenGost.Security.Cryptography.Benchmarks/OpenGost.Security.Cryptography.Benchmarks.csproj b/benchmarks/OpenGost.Security.Cryptography.Benchmarks/OpenGost.Security.Cryptography.Benchmarks.csproj
index 535dc4e..416b280 100644
--- a/benchmarks/OpenGost.Security.Cryptography.Benchmarks/OpenGost.Security.Cryptography.Benchmarks.csproj
+++ b/benchmarks/OpenGost.Security.Cryptography.Benchmarks/OpenGost.Security.Cryptography.Benchmarks.csproj
@@ -1,7 +1,7 @@
- net48;net6.0;net8.0
+ net9.0
Exe
diff --git a/global.json b/global.json
index c19a2e0..2bc13e8 100644
--- a/global.json
+++ b/global.json
@@ -1,6 +1,6 @@
{
"sdk": {
- "version": "8.0.100",
+ "version": "9.0.100",
"rollForward": "latestMinor"
}
}
diff --git a/src/Directory.Build.props b/src/Directory.Build.props
index 2c8c06f..b829ee7 100644
--- a/src/Directory.Build.props
+++ b/src/Directory.Build.props
@@ -5,7 +5,6 @@
true
true
- 7
true
true
snupkg
@@ -17,7 +16,7 @@
latest-all
true
true
- $(NoWarn);CA1508;CA1859;CA5358;NU1903;SYSLIB0045
+ $(NoWarn);CA5358;SYSLIB0045
diff --git a/src/OpenGost.Security.Cryptography/CMAC.cs b/src/OpenGost.Security.Cryptography/CMAC.cs
index d8ab1b1..a5e6db1 100644
--- a/src/OpenGost.Security.Cryptography/CMAC.cs
+++ b/src/OpenGost.Security.Cryptography/CMAC.cs
@@ -10,22 +10,20 @@ namespace OpenGost.Security.Cryptography;
[ComVisible(true)]
public abstract class CMAC : KeyedHashAlgorithm
{
- private static readonly IReadOnlyDictionary _irreduciblePolynomials = new Dictionary
- {
- [64] =
+ private static readonly byte[]
+ _irreduciblePolynomial64 =
[
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1B
],
- [128] =
+ _irreduciblePolynomial128 =
[
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x87
],
- [256] =
+ _irreduciblePolynomial256 =
[
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x25
- ],
- };
+ ];
private SymmetricAlgorithm _symmetricAlgorithm = null!;
private ICryptoTransform? _encryptor;
@@ -58,12 +56,8 @@ public override byte[] Key
get => (byte[])KeyValue.Clone();
set
{
-#if NET6_0_OR_GREATER
ArgumentNullException.ThrowIfNull(value);
-#else
- if (value is null)
- throw new ArgumentNullException(nameof(value));
-#endif
+
if (_hashing)
throw new CryptographicException(CryptographyStrings.CryptographicSymmetricAlgorithmKeySet);
@@ -170,19 +164,19 @@ protected override void HashCore(byte[] array, int ibStart, int cbSize)
Buffer.BlockCopy(array, ibStart, _buffer, _bufferLength, bytesToCopy);
ibStart += bytesToCopy;
cbSize -= bytesToCopy;
- _encryptor!.TransformBlock(_buffer, 0, _bytesPerBlock, _temp, 0);
+ _ = _encryptor!.TransformBlock(_buffer, 0, _bytesPerBlock, _temp, 0);
_bufferLength = 0;
}
if (cbSize >= _bytesPerBlock && _bufferLength == _bytesPerBlock)
{
- _encryptor!.TransformBlock(_buffer, 0, _bytesPerBlock, _temp, 0);
+ _ = _encryptor!.TransformBlock(_buffer, 0, _bytesPerBlock, _temp, 0);
_bufferLength = 0;
}
while (cbSize > _bytesPerBlock)
{
- _encryptor!.TransformBlock(array, ibStart, _bytesPerBlock, _temp, 0);
+ _ = _encryptor!.TransformBlock(array, ibStart, _bytesPerBlock, _temp, 0);
ibStart += _bytesPerBlock;
cbSize -= _bytesPerBlock;
}
@@ -242,8 +236,6 @@ protected override void Dispose(bool disposing)
base.Dispose(disposing);
}
- #region Creation factory methods
-
///
/// Creates an instance of the default implementation of algorithm.
///
@@ -251,8 +243,11 @@ protected override void Dispose(bool disposing)
/// A new instance of .
///
[ComVisible(false)]
+ [Obsolete(Obsoletions.DefaultCryptoAlgorithmsMessage,
+ DiagnosticId = Obsoletions.DefaultCryptoAlgorithmsDiagId,
+ UrlFormat = Obsoletions.SharedUrlFormat)]
public static new CMAC Create()
- => Create(CryptoConstants.CMACGrasshopperAlgorithmName);
+ => new CMACGrasshopper();
///
/// Creates an instance of a specified implementation of algorithm.
@@ -267,8 +262,6 @@ protected override void Dispose(bool disposing)
public static new CMAC Create(string algorithmName)
=> (CMAC)CryptoConfig.CreateFromName(algorithmName)!;
- #endregion
-
private void EnsureEncryptorInitialized()
{
if (_encryptor is null)
@@ -319,9 +312,12 @@ private static void LeftShiftLittleEndianOneBit(byte[] data)
private static byte[] GetIrreduciblePolynomial(int blockSize)
{
- if (_irreduciblePolynomials.TryGetValue(blockSize, out var result))
- return result;
-
- throw new CryptographicException(CryptographyStrings.CryptographicInvalidBlockSize);
+ return blockSize switch
+ {
+ 64 => _irreduciblePolynomial64,
+ 128 => _irreduciblePolynomial128,
+ 256 => _irreduciblePolynomial256,
+ _ => throw new CryptographicException(CryptographyStrings.CryptographicInvalidBlockSize),
+ };
}
}
diff --git a/src/OpenGost.Security.Cryptography/ECCurveOidMap.cs b/src/OpenGost.Security.Cryptography/ECCurveOidMap.cs
index c3da0dd..c27032b 100644
--- a/src/OpenGost.Security.Cryptography/ECCurveOidMap.cs
+++ b/src/OpenGost.Security.Cryptography/ECCurveOidMap.cs
@@ -453,23 +453,15 @@ private static IReadOnlyDictionary ECCurveOidDictionary
public static bool OidValueRegistered(string oidValue)
{
-#if NET6_0_OR_GREATER
ArgumentNullException.ThrowIfNull(oidValue);
-#else
- if (oidValue is null)
- throw new ArgumentNullException(nameof(oidValue));
-#endif
+
return ECCurveOidDictionary.ContainsKey(oidValue);
}
public static ECCurve GetExplicitCurveByOid(string oidValue)
{
-#if NET6_0_OR_GREATER
ArgumentNullException.ThrowIfNull(oidValue);
-#else
- if (oidValue is null)
- throw new ArgumentNullException(nameof(oidValue));
-#endif
+
if (!ECCurveOidDictionary.ContainsKey(oidValue))
throw new NotImplementedException();
diff --git a/src/OpenGost.Security.Cryptography/GostECDsa.cs b/src/OpenGost.Security.Cryptography/GostECDsa.cs
index de8bc82..027c085 100644
--- a/src/OpenGost.Security.Cryptography/GostECDsa.cs
+++ b/src/OpenGost.Security.Cryptography/GostECDsa.cs
@@ -27,8 +27,6 @@ protected GostECDsa()
KeySizeValue = 512;
}
- #region Creation factory methods
-
///
/// Creates an instance of the default implementation of algorithm.
///
@@ -37,20 +35,5 @@ protected GostECDsa()
///
[ComVisible(false)]
public static new GostECDsa Create()
- => Create(CryptoConstants.GostECDsaAlgorithmName);
-
- ///
- /// Creates an instance of a specified implementation of algorithm.
- ///
- ///
- /// The name of the specific implementation of to be used.
- ///
- ///
- /// A new instance of using the specified implementation.
- ///
- [ComVisible(false)]
- public static new GostECDsa Create(string algorithmName)
- => (GostECDsa)CryptoConfig.CreateFromName(algorithmName)!;
-
- #endregion
+ => new GostECDsaManaged();
}
diff --git a/src/OpenGost.Security.Cryptography/GostECDsaCertificateExtensions.cs b/src/OpenGost.Security.Cryptography/GostECDsaCertificateExtensions.cs
index 4569c57..2971c5f 100644
--- a/src/OpenGost.Security.Cryptography/GostECDsaCertificateExtensions.cs
+++ b/src/OpenGost.Security.Cryptography/GostECDsaCertificateExtensions.cs
@@ -3,7 +3,9 @@
using OpenGost.Security.Cryptography.Asn1;
using OpenGost.Security.Cryptography.Properties;
+#pragma warning disable IDE0130
namespace System.Security.Cryptography.X509Certificates;
+#pragma warning restore IDE0130
using static CryptoConstants;
@@ -32,12 +34,7 @@ public static class GostECDsaCertificateExtensions
///
public static GostECDsa? GetGostECDsaPublicKey(this X509Certificate2 certificate)
{
-#if NET6_0_OR_GREATER
ArgumentNullException.ThrowIfNull(certificate);
-#else
- if (certificate is null)
- throw new ArgumentNullException(nameof(certificate));
-#endif
if (!IsGostECDsa(certificate))
return null;
@@ -87,7 +84,7 @@ public static class GostECDsaCertificateExtensions
private static bool IsGostECDsa(X509Certificate2 certificate)
{
var value = certificate.PublicKey.Oid.Value;
- if (value != GostECDsa256OidValue && value != GostECDsa512OidValue)
+ if (value is not GostECDsa256OidValue and not GostECDsa512OidValue)
return false;
foreach (var extension in certificate.Extensions)
diff --git a/src/OpenGost.Security.Cryptography/GostECDsaManaged.cs b/src/OpenGost.Security.Cryptography/GostECDsaManaged.cs
index b747954..467cc9e 100644
--- a/src/OpenGost.Security.Cryptography/GostECDsaManaged.cs
+++ b/src/OpenGost.Security.Cryptography/GostECDsaManaged.cs
@@ -151,12 +151,7 @@ public override void ImportParameters(ECParameters parameters)
///
public override byte[] SignHash(byte[] hash)
{
-#if NET6_0_OR_GREATER
ArgumentNullException.ThrowIfNull(hash);
-#else
- if (hash is null)
- throw new ArgumentNullException(nameof(hash));
-#endif
ThrowIfDisposed();
@@ -232,15 +227,8 @@ private static byte[] SignHash(
///
public override bool VerifyHash(byte[] hash, byte[] signature)
{
-#if NET6_0_OR_GREATER
ArgumentNullException.ThrowIfNull(hash);
ArgumentNullException.ThrowIfNull(signature);
-#else
- if (hash is null)
- throw new ArgumentNullException(nameof(hash));
- if (signature is null)
- throw new ArgumentNullException(nameof(signature));
-#endif
ThrowIfDisposed();
@@ -332,18 +320,17 @@ private static ECCurve GetExplicitCurve(in ECCurve curve)
{
ECCurve.ECCurveType.PrimeShortWeierstrass => curve,
ECCurve.ECCurveType.Named => ECCurveOidMap.GetExplicitCurveByOid(curve.Oid.Value!),
+ ECCurve.ECCurveType.Implicit or
+ ECCurve.ECCurveType.PrimeTwistedEdwards or
+ ECCurve.ECCurveType.PrimeMontgomery or
+ ECCurve.ECCurveType.Characteristic2 or
_ => throw new NotImplementedException(),
};
}
private void ThrowIfDisposed()
{
-#if NET8_0_OR_GREATER
ObjectDisposedException.ThrowIf(_disposed, this);
-#else
- if (_disposed)
- throw new ObjectDisposedException(GetType().FullName);
-#endif
}
private static ECCurve GetDefaultCurve(int keySize)
diff --git a/src/OpenGost.Security.Cryptography/GostECDsaSignatureDeformatter.cs b/src/OpenGost.Security.Cryptography/GostECDsaSignatureDeformatter.cs
index aaf0c4f..7566da8 100644
--- a/src/OpenGost.Security.Cryptography/GostECDsaSignatureDeformatter.cs
+++ b/src/OpenGost.Security.Cryptography/GostECDsaSignatureDeformatter.cs
@@ -6,15 +6,9 @@ internal sealed class GostECDsaSignatureDeformatter : AsymmetricSignatureDeforma
public override bool VerifySignature(byte[] rgbHash, byte[] rgbSignature)
{
-#if NET6_0_OR_GREATER
ArgumentNullException.ThrowIfNull(rgbHash);
ArgumentNullException.ThrowIfNull(rgbSignature);
-#else
- if (rgbHash is null)
- throw new ArgumentNullException(nameof(rgbHash));
- if (rgbSignature is null)
- throw new ArgumentNullException(nameof(rgbSignature));
-#endif
+
if (_key is null)
throw new CryptographicUnexpectedOperationException();
@@ -27,12 +21,7 @@ public override void SetHashAlgorithm(string strName)
public override void SetKey(AsymmetricAlgorithm key)
{
-#if NET6_0_OR_GREATER
ArgumentNullException.ThrowIfNull(key);
-#else
- if (key is null)
- throw new ArgumentNullException(nameof(key));
-#endif
_key = (GostECDsa)key;
}
diff --git a/src/OpenGost.Security.Cryptography/GostECDsaSignatureFormatter.cs b/src/OpenGost.Security.Cryptography/GostECDsaSignatureFormatter.cs
index b61e772..a9d7c52 100644
--- a/src/OpenGost.Security.Cryptography/GostECDsaSignatureFormatter.cs
+++ b/src/OpenGost.Security.Cryptography/GostECDsaSignatureFormatter.cs
@@ -6,12 +6,8 @@ internal sealed class GostECDsaSignatureFormatter : AsymmetricSignatureFormatter
public override byte[] CreateSignature(byte[] rgbHash)
{
-#if NET6_0_OR_GREATER
ArgumentNullException.ThrowIfNull(rgbHash);
-#else
- if (rgbHash is null)
- throw new ArgumentNullException(nameof(rgbHash));
-#endif
+
if (_key is null)
throw new CryptographicUnexpectedOperationException();
@@ -24,12 +20,7 @@ public override void SetHashAlgorithm(string strName)
public override void SetKey(AsymmetricAlgorithm key)
{
-#if NET6_0_OR_GREATER
ArgumentNullException.ThrowIfNull(key);
-#else
- if (key is null)
- throw new ArgumentNullException(nameof(key));
-#endif
_key = (GostECDsa)key;
}
diff --git a/src/OpenGost.Security.Cryptography/Grasshopper.cs b/src/OpenGost.Security.Cryptography/Grasshopper.cs
index d5895e0..2902885 100644
--- a/src/OpenGost.Security.Cryptography/Grasshopper.cs
+++ b/src/OpenGost.Security.Cryptography/Grasshopper.cs
@@ -62,12 +62,9 @@ public override byte[] IV
{
set
{
-#if NET6_0_OR_GREATER
+
ArgumentNullException.ThrowIfNull(value);
-#else
- if (value is null)
- throw new ArgumentNullException(nameof(value));
-#endif
+
if (value.Length == 0 || value.Length % (BlockSizeValue / 8) != 0)
throw new CryptographicException(CryptographyStrings.CryptographicInvalidIVSize);
@@ -76,8 +73,6 @@ public override byte[] IV
}
}
- #region Creation factory methods
-
///
/// Creates an instance of the default implementation of algorithm.
///
@@ -86,20 +81,5 @@ public override byte[] IV
///
[ComVisible(false)]
public static new Grasshopper Create()
- => Create(CryptoConstants.GrasshopperAlgorithmName);
-
- ///
- /// Creates an instance of a specified implementation of algorithm.
- ///
- ///
- /// The name of the specific implementation of to be used.
- ///
- ///
- /// A new instance of using the specified implementation.
- ///
- [ComVisible(false)]
- public static new Grasshopper Create(string algorithmName)
- => (Grasshopper)CryptoConfig.CreateFromName(algorithmName)!;
-
- #endregion
+ => new GrasshopperManaged();
}
diff --git a/src/OpenGost.Security.Cryptography/GrasshopperManaged.cs b/src/OpenGost.Security.Cryptography/GrasshopperManaged.cs
index fdff41b..ccfc492 100644
--- a/src/OpenGost.Security.Cryptography/GrasshopperManaged.cs
+++ b/src/OpenGost.Security.Cryptography/GrasshopperManaged.cs
@@ -24,7 +24,7 @@ public override CipherMode Mode
{
set
{
- if (value < CipherMode.CBC || CipherMode.CFB < value)
+ if (value is < CipherMode.CBC or > CipherMode.CFB)
throw new CryptographicException(CryptographyStrings.CryptographicInvalidCipherMode);
ModeValue = value;
diff --git a/src/OpenGost.Security.Cryptography/HMACCommon.cs b/src/OpenGost.Security.Cryptography/HMACCommon.cs
index 9e61e10..74fb628 100644
--- a/src/OpenGost.Security.Cryptography/HMACCommon.cs
+++ b/src/OpenGost.Security.Cryptography/HMACCommon.cs
@@ -44,27 +44,27 @@ public void Initialize()
public void HashCore(byte[] data, int offset, int count)
{
- if (_hashing == false)
+ if (!_hashing)
{
- _hash1.TransformBlock(_inner, 0, _inner.Length, _inner, 0);
+ _ = _hash1.TransformBlock(_inner, 0, _inner.Length, _inner, 0);
_hashing = true;
}
- _hash1.TransformBlock(data, offset, count, data, offset);
+ _ = _hash1.TransformBlock(data, offset, count, data, offset);
}
public byte[] HashFinal()
{
- if (_hashing == false)
+ if (!_hashing)
{
- _hash1.TransformBlock(_inner, 0, _inner.Length, _inner, 0);
+ _ = _hash1.TransformBlock(_inner, 0, _inner.Length, _inner, 0);
_hashing = true;
}
- _hash1.TransformFinalBlock([], 0, 0);
+ _ = _hash1.TransformFinalBlock([], 0, 0);
var hashValue1 = _hash1.Hash!;
- _hash2.TransformBlock(_outer, 0, _outer.Length, _outer, 0);
- _hash2.TransformBlock(hashValue1, 0, hashValue1.Length, hashValue1, 0);
+ _ = _hash2.TransformBlock(_outer, 0, _outer.Length, _outer, 0);
+ _ = _hash2.TransformBlock(hashValue1, 0, hashValue1.Length, hashValue1, 0);
_hashing = false;
- _hash2.TransformFinalBlock([], 0, 0);
+ _ = _hash2.TransformFinalBlock([], 0, 0);
return _hash2.Hash!;
}
diff --git a/src/OpenGost.Security.Cryptography/HMACStreebog256.cs b/src/OpenGost.Security.Cryptography/HMACStreebog256.cs
index 2ec8acc..d7a7da1 100644
--- a/src/OpenGost.Security.Cryptography/HMACStreebog256.cs
+++ b/src/OpenGost.Security.Cryptography/HMACStreebog256.cs
@@ -25,12 +25,7 @@ public override byte[] Key
{
set
{
-#if NET6_0_OR_GREATER
ArgumentNullException.ThrowIfNull(value);
-#else
- if (value is null)
- throw new ArgumentNullException(nameof(value));
-#endif
_hmacCommon.ChangeKey(value);
base.Key = _hmacCommon.ActualKey;
@@ -57,12 +52,7 @@ public HMACStreebog256()
///
public HMACStreebog256(byte[] key)
{
-#if NET6_0_OR_GREATER
ArgumentNullException.ThrowIfNull(key);
-#else
- if (key is null)
- throw new ArgumentNullException(nameof(key));
-#endif
HashName = CryptoConstants.Streebog256AlgorithmName;
_hmacCommon = new HMACCommon(CryptoConstants.Streebog256AlgorithmName, key, BlockSize);
diff --git a/src/OpenGost.Security.Cryptography/HMACStreebog512.cs b/src/OpenGost.Security.Cryptography/HMACStreebog512.cs
index 8d24b4d..52f8f93 100644
--- a/src/OpenGost.Security.Cryptography/HMACStreebog512.cs
+++ b/src/OpenGost.Security.Cryptography/HMACStreebog512.cs
@@ -25,12 +25,7 @@ public override byte[] Key
{
set
{
-#if NET6_0_OR_GREATER
ArgumentNullException.ThrowIfNull(value);
-#else
- if (value is null)
- throw new ArgumentNullException(nameof(value));
-#endif
_hmacCommon.ChangeKey(value);
base.Key = _hmacCommon.ActualKey;
@@ -57,12 +52,7 @@ public HMACStreebog512()
///
public HMACStreebog512(byte[] key)
{
-#if NET6_0_OR_GREATER
ArgumentNullException.ThrowIfNull(key);
-#else
- if (key is null)
- throw new ArgumentNullException(nameof(key));
-#endif
HashName = CryptoConstants.Streebog512AlgorithmName;
_hmacCommon = new HMACCommon(CryptoConstants.Streebog512AlgorithmName, key, BlockSize);
diff --git a/src/OpenGost.Security.Cryptography/Magma.cs b/src/OpenGost.Security.Cryptography/Magma.cs
index e79371d..ccf159f 100644
--- a/src/OpenGost.Security.Cryptography/Magma.cs
+++ b/src/OpenGost.Security.Cryptography/Magma.cs
@@ -62,12 +62,8 @@ public override byte[] IV
{
set
{
-#if NET6_0_OR_GREATER
ArgumentNullException.ThrowIfNull(value);
-#else
- if (value is null)
- throw new ArgumentNullException(nameof(value));
-#endif
+
if (value.Length == 0 || value.Length % (BlockSizeValue / 8) != 0)
throw new CryptographicException(CryptographyStrings.CryptographicInvalidIVSize);
@@ -76,8 +72,6 @@ public override byte[] IV
}
}
- #region Creation factory methods
-
///
/// Creates an instance of the default implementation of algorithm.
///
@@ -86,20 +80,5 @@ public override byte[] IV
///
[ComVisible(false)]
public static new Magma Create()
- => Create(CryptoConstants.MagmaAlgorithmName);
-
- ///
- /// Creates an instance of a specified implementation of algorithm.
- ///
- ///
- /// The name of the specific implementation of to be used.
- ///
- ///
- /// A new instance of using the specified implementation.
- ///
- [ComVisible(false)]
- public static new Magma Create(string algorithmName)
- => (Magma)CryptoConfig.CreateFromName(algorithmName)!;
-
- #endregion
+ => new MagmaManaged();
}
diff --git a/src/OpenGost.Security.Cryptography/MagmaManaged.cs b/src/OpenGost.Security.Cryptography/MagmaManaged.cs
index 468d4a1..d43fbf7 100644
--- a/src/OpenGost.Security.Cryptography/MagmaManaged.cs
+++ b/src/OpenGost.Security.Cryptography/MagmaManaged.cs
@@ -24,7 +24,7 @@ public override CipherMode Mode
{
set
{
- if (value < CipherMode.CBC || CipherMode.CFB < value)
+ if (value is < CipherMode.CBC or > CipherMode.CFB)
throw new CryptographicException(CryptographyStrings.CryptographicInvalidCipherMode);
ModeValue = value;
diff --git a/src/OpenGost.Security.Cryptography/Obsoletions.cs b/src/OpenGost.Security.Cryptography/Obsoletions.cs
new file mode 100644
index 0000000..e890e3d
--- /dev/null
+++ b/src/OpenGost.Security.Cryptography/Obsoletions.cs
@@ -0,0 +1,9 @@
+namespace OpenGost.Security.Cryptography;
+
+internal static class Obsoletions
+{
+ internal const string
+ SharedUrlFormat = "https://aka.ms/dotnet-warnings/{0}",
+ DefaultCryptoAlgorithmsMessage = "The default implementation of this cryptography algorithm is not supported.",
+ DefaultCryptoAlgorithmsDiagId = "SYSLIB0007";
+}
diff --git a/src/OpenGost.Security.Cryptography/OpenGost.Security.Cryptography.csproj b/src/OpenGost.Security.Cryptography/OpenGost.Security.Cryptography.csproj
index 7b2db08..5ad2af4 100644
--- a/src/OpenGost.Security.Cryptography/OpenGost.Security.Cryptography.csproj
+++ b/src/OpenGost.Security.Cryptography/OpenGost.Security.Cryptography.csproj
@@ -1,7 +1,7 @@
- netstandard2.0;net6.0;net8.0
+ net9.0
true
An open-source .NET library providing the modern Russian national standard cryptographic algorithms
@@ -26,7 +26,7 @@ This is the first public release.
-
+
@@ -54,4 +54,8 @@ This is the first public release.
+
+
+
+
diff --git a/src/OpenGost.Security.Cryptography/OpenGostCryptoConfig.cs b/src/OpenGost.Security.Cryptography/OpenGostCryptoConfig.cs
index 68b7d3e..75fda2c 100644
--- a/src/OpenGost.Security.Cryptography/OpenGostCryptoConfig.cs
+++ b/src/OpenGost.Security.Cryptography/OpenGostCryptoConfig.cs
@@ -17,7 +17,7 @@ public static class OpenGostCryptoConfig
///
public static void ConfigureCryptographicServices()
{
- if(!_configured)
+ if (!_configured)
lock (_syncRoot)
if (!_configured)
{
diff --git a/src/OpenGost.Security.Cryptography/Properties/CryptographyStrings.Designer.cs b/src/OpenGost.Security.Cryptography/Properties/CryptographyStrings.Designer.cs
index e461896..7f7fc21 100644
--- a/src/OpenGost.Security.Cryptography/Properties/CryptographyStrings.Designer.cs
+++ b/src/OpenGost.Security.Cryptography/Properties/CryptographyStrings.Designer.cs
@@ -33,6 +33,9 @@ public static string CryptographicInvalidBlockSize
public static string CryptographicInvalidCipherMode
=> GetString("CryptographicInvalidCipherMode");
+ public static string CryptographicInvalidPaddingMode
+ => GetString("CryptographicInvalidPaddingMode");
+
public static string CryptographicInvalidDataSize
=> GetString("CryptographicInvalidDataSize");
diff --git a/src/OpenGost.Security.Cryptography/Properties/CryptographyStrings.resx b/src/OpenGost.Security.Cryptography/Properties/CryptographyStrings.resx
index 1b034cc..049290a 100644
--- a/src/OpenGost.Security.Cryptography/Properties/CryptographyStrings.resx
+++ b/src/OpenGost.Security.Cryptography/Properties/CryptographyStrings.resx
@@ -141,6 +141,9 @@
Specified cipher mode is not valid for this algorithm.
+
+ Specified padding mode is not valid for this algorithm.
+
Length of the data to transform is invalid.
diff --git a/src/OpenGost.Security.Cryptography/Properties/CryptographyStrings.ru.resx b/src/OpenGost.Security.Cryptography/Properties/CryptographyStrings.ru.resx
index f63c23d..553ab00 100644
--- a/src/OpenGost.Security.Cryptography/Properties/CryptographyStrings.ru.resx
+++ b/src/OpenGost.Security.Cryptography/Properties/CryptographyStrings.ru.resx
@@ -141,6 +141,9 @@
Заданный режим шифрования недопустим для этого алгоритма.
+
+ Заданный режим дополнения недопустим для этого алгоритма.
+
Недопустимая длина данных для выполнения операции.
diff --git a/src/OpenGost.Security.Cryptography/Streebog256.cs b/src/OpenGost.Security.Cryptography/Streebog256.cs
index 7dd1f86..da0042d 100644
--- a/src/OpenGost.Security.Cryptography/Streebog256.cs
+++ b/src/OpenGost.Security.Cryptography/Streebog256.cs
@@ -16,8 +16,6 @@ protected Streebog256()
HashSizeValue = 256;
}
- #region Creation factory methods
-
///
/// Creates an instance of the default implementation of algorithm.
///
@@ -26,20 +24,5 @@ protected Streebog256()
///
[ComVisible(false)]
public static new Streebog256 Create()
- => Create(CryptoConstants.Streebog256AlgorithmName);
-
- ///
- /// Creates an instance of a specified implementation of algorithm.
- ///
- ///
- /// The name of the specific implementation of to be used.
- ///
- ///
- /// A new instance of using the specified implementation.
- ///
- [ComVisible(false)]
- public static new Streebog256 Create(string algorithmName)
- => (Streebog256)CryptoConfig.CreateFromName(algorithmName)!;
-
- #endregion
+ => new Streebog256Managed();
}
diff --git a/src/OpenGost.Security.Cryptography/Streebog256Managed.cs b/src/OpenGost.Security.Cryptography/Streebog256Managed.cs
index f24ba7e..0f0373f 100644
--- a/src/OpenGost.Security.Cryptography/Streebog256Managed.cs
+++ b/src/OpenGost.Security.Cryptography/Streebog256Managed.cs
@@ -61,9 +61,7 @@ protected override void HashCore(byte[] array, int ibStart, int cbSize)
///
protected override byte[] HashFinal()
{
- _innerAlgorithm.TransformFinalBlock(
- [],
- 0, 0);
+ _ = _innerAlgorithm.TransformFinalBlock([], 0, 0);
var hash = new byte[32];
Buffer.BlockCopy(_innerAlgorithm.Hash!, 32, hash, 0, 32);
HashValue = hash;
diff --git a/src/OpenGost.Security.Cryptography/Streebog512.cs b/src/OpenGost.Security.Cryptography/Streebog512.cs
index a1ee35a..d3041b3 100644
--- a/src/OpenGost.Security.Cryptography/Streebog512.cs
+++ b/src/OpenGost.Security.Cryptography/Streebog512.cs
@@ -16,8 +16,6 @@ protected Streebog512()
HashSizeValue = 512;
}
- #region Creation factory methods
-
///
/// Creates an instance of the default implementation of algorithm.
///
@@ -26,20 +24,5 @@ protected Streebog512()
///
[ComVisible(false)]
public static new Streebog512 Create()
- => Create(CryptoConstants.Streebog512AlgorithmName);
-
- ///
- /// Creates an instance of a specified implementation of algorithm.
- ///
- ///
- /// The name of the specific implementation of to be used.
- ///
- ///
- /// A new instance of using the specified implementation.
- ///
- [ComVisible(false)]
- public static new Streebog512 Create(string algorithmName)
- => (Streebog512)CryptoConfig.CreateFromName(algorithmName)!;
-
- #endregion
+ => new Streebog512Managed();
}
diff --git a/src/OpenGost.Security.Cryptography/SymmetricTransform.cs b/src/OpenGost.Security.Cryptography/SymmetricTransform.cs
index 12657a9..7db2bf1 100644
--- a/src/OpenGost.Security.Cryptography/SymmetricTransform.cs
+++ b/src/OpenGost.Security.Cryptography/SymmetricTransform.cs
@@ -31,12 +31,8 @@ protected SymmetricTransform(
PaddingMode paddingMode,
bool encrypting)
{
-#if NET6_0_OR_GREATER
ArgumentNullException.ThrowIfNull(key);
-#else
- if (key is null)
- throw new ArgumentNullException(nameof(key));
-#endif
+
if (blockSize <= 0)
throw new ArgumentOutOfRangeException(nameof(blockSize),
CryptographyStrings.ArgumentOutOfRangeNeedPositiveNum);
@@ -54,18 +50,14 @@ protected SymmetricTransform(
case CipherMode.CBC:
case CipherMode.CFB:
case CipherMode.OFB:
-#if NET6_0_OR_GREATER
ArgumentNullException.ThrowIfNull(iv);
-#else
- if (iv is null)
- throw new ArgumentNullException(nameof(iv));
-#endif
_rgbIV = (byte[])iv.Clone();
_stateBuffer = new byte[_rgbIV.Length];
_tempBuffer = new byte[InputBlockSize];
Reset();
break;
+ case CipherMode.CTS:
default:
throw new CryptographicException(CryptographyStrings.CryptographicInvalidCipherMode);
}
@@ -90,7 +82,7 @@ private void Reset()
{
CryptoUtils.EraseData(ref _depadBuffer);
- if (_cipherMode == CipherMode.CBC || _cipherMode == CipherMode.CFB || _cipherMode == CipherMode.OFB)
+ if (_cipherMode is CipherMode.CBC or CipherMode.CFB or CipherMode.OFB)
{
Buffer.BlockCopy(_rgbIV!, 0, _stateBuffer!, 0, _rgbIV!.Length);
}
@@ -103,15 +95,8 @@ public int TransformBlock(
byte[] outputBuffer,
int outputOffset)
{
-#if NET6_0_OR_GREATER
ArgumentNullException.ThrowIfNull(inputBuffer);
ArgumentNullException.ThrowIfNull(outputBuffer);
-#else
- if (inputBuffer is null)
- throw new ArgumentNullException(nameof(inputBuffer));
- if (outputBuffer is null)
- throw new ArgumentNullException(nameof(outputBuffer));
-#endif
if (inputOffset < 0)
throw new ArgumentOutOfRangeException(nameof(inputOffset), inputOffset,
CryptographyStrings.ArgumentOutOfRangeNeedNonNegNum);
@@ -132,7 +117,7 @@ public int TransformBlock(
return EncryptData(inputBuffer, inputOffset, inputCount, ref outputBuffer!, outputOffset, false);
else
{
- if (_paddingMode == PaddingMode.Zeros || _paddingMode == PaddingMode.None)
+ if (_paddingMode is PaddingMode.Zeros or PaddingMode.None)
return DecryptData(inputBuffer, inputOffset, inputCount, ref outputBuffer!, outputOffset, false);
else
{
@@ -149,7 +134,7 @@ public int TransformBlock(
else
{
// we already have a depad buffer, so we need to decrypt that info first & copy it out
- DecryptData(_depadBuffer, 0, _depadBuffer.Length, ref outputBuffer!, outputOffset, false);
+ _ = DecryptData(_depadBuffer, 0, _depadBuffer.Length, ref outputBuffer!, outputOffset, false);
outputOffset += OutputBlockSize;
var inputToProcess = inputCount - InputBlockSize;
Buffer.BlockCopy(inputBuffer, inputOffset + inputToProcess, _depadBuffer, 0, InputBlockSize);
@@ -162,12 +147,7 @@ public int TransformBlock(
public byte[] TransformFinalBlock(byte[] inputBuffer, int inputOffset, int inputCount)
{
-#if NET6_0_OR_GREATER
ArgumentNullException.ThrowIfNull(inputBuffer);
-#else
- if (inputBuffer is null)
- throw new ArgumentNullException(nameof(inputBuffer));
-#endif
if (inputOffset < 0)
throw new ArgumentOutOfRangeException(nameof(inputOffset), inputOffset,
CryptographyStrings.ArgumentOutOfRangeNeedNonNegNum);
@@ -181,20 +161,20 @@ public byte[] TransformFinalBlock(byte[] inputBuffer, int inputOffset, int input
byte[] transformedBytes = null!;
if (_encrypting)
- EncryptData(inputBuffer, inputOffset, inputCount, ref transformedBytes!, 0, true);
+ _ = EncryptData(inputBuffer, inputOffset, inputCount, ref transformedBytes!, 0, true);
else
{
if (inputCount % InputBlockSize != 0)
throw new CryptographicException(CryptographyStrings.CryptographicInvalidDataSize);
if (_depadBuffer is null)
- DecryptData(inputBuffer, inputOffset, inputCount, ref transformedBytes!, 0, true);
+ _ = DecryptData(inputBuffer, inputOffset, inputCount, ref transformedBytes!, 0, true);
else
{
var temp = new byte[_depadBuffer.Length + inputCount];
Buffer.BlockCopy(_depadBuffer, 0, temp, 0, _depadBuffer.Length);
Buffer.BlockCopy(inputBuffer, inputOffset, temp, _depadBuffer.Length, inputCount);
- DecryptData(temp, 0, temp.Length, ref transformedBytes!, 0, true);
+ _ = DecryptData(temp, 0, temp.Length, ref transformedBytes!, 0, true);
}
}
Reset();
@@ -306,6 +286,7 @@ private int EncryptData(
}
break;
+ case CipherMode.CTS:
default:
throw new CryptographicException(CryptographyStrings.CryptographicInvalidCipherMode);
}
@@ -356,6 +337,7 @@ private void EncryptPaddedBlock(
InputBlockSize);
break;
+ case CipherMode.CTS:
default:
throw new CryptographicException(CryptographyStrings.CryptographicInvalidCipherMode);
}
@@ -384,6 +366,9 @@ private void EncryptPaddedBlock(
case PaddingMode.ISO10126:
padSize = InputBlockSize - lonelyBytes;
break;
+
+ default:
+ throw new CryptographicException(CryptographyStrings.CryptographicInvalidPaddingMode);
}
if (padSize != 0)
@@ -415,6 +400,9 @@ private void EncryptPaddedBlock(
// and change the last byte
padBytes[padSize - 1] = (byte)padSize;
break;
+
+ default:
+ throw new CryptographicException(CryptographyStrings.CryptographicInvalidPaddingMode);
}
}
@@ -483,6 +471,7 @@ private int DecryptData(
}
break;
+ case CipherMode.CTS:
default:
throw new CryptographicException(CryptographyStrings.CryptographicInvalidCipherMode);
}
@@ -525,6 +514,9 @@ private int DecryptData(
// no additional check, just ignore the random bytes
RemovePadding(ref outputBuffer, padSize);
break;
+
+ default:
+ throw new CryptographicException(CryptographyStrings.CryptographicInvalidCipherMode);
}
return outputBuffer.Length;
diff --git a/tests/OpenGost.Security.Cryptography.Tests/CreationFactoriesFacts.cs b/tests/OpenGost.Security.Cryptography.Tests/CreationFactoriesFacts.cs
index a207599..d2f3ab3 100644
--- a/tests/OpenGost.Security.Cryptography.Tests/CreationFactoriesFacts.cs
+++ b/tests/OpenGost.Security.Cryptography.Tests/CreationFactoriesFacts.cs
@@ -40,36 +40,16 @@ public void CreateExplicit_ReturnsValidInstance(
public static TheoryData> ExplicitCreateFactories()
=> new()
{
- { typeof(GostECDsa), GostECDsa.Create },
- { typeof(Grasshopper), Grasshopper.Create },
- { typeof(Magma), Magma.Create },
- { typeof(Streebog256), Streebog256.Create },
- { typeof(Streebog512), Streebog512.Create },
{ typeof(CMACGrasshopper), CMAC.Create },
{ typeof(CMACMagma), CMAC.Create },
- { typeof(GostECDsa), ECDsa.Create },
- { typeof(GostECDsa), AsymmetricAlgorithm.Create },
- { typeof(Grasshopper), SymmetricAlgorithm.Create },
- { typeof(Magma), SymmetricAlgorithm.Create },
- { typeof(Streebog256), HashAlgorithm.Create },
- { typeof(Streebog512), HashAlgorithm.Create },
- { typeof(CMACGrasshopper), HashAlgorithm.Create },
- { typeof(CMACGrasshopper), KeyedHashAlgorithm.Create },
- { typeof(CMACMagma), HashAlgorithm.Create },
- { typeof(CMACMagma), KeyedHashAlgorithm.Create },
- { typeof(HMACStreebog256), HashAlgorithm.Create },
- { typeof(HMACStreebog256), KeyedHashAlgorithm.Create },
- { typeof(HMACStreebog256), HMAC.Create },
- { typeof(HMACStreebog512), HashAlgorithm.Create },
- { typeof(HMACStreebog512), KeyedHashAlgorithm.Create },
- { typeof(HMACStreebog512), HMAC.Create },
};
public static TheoryData> ImplicitCreateFactories()
=> new()
{
+#pragma warning disable SYSLIB0007
{ typeof(CMACGrasshopper), CMAC.Create },
- { typeof(CMACGrasshopper), CMAC.Create },
+#pragma warning restore SYSLIB0007
{ typeof(GostECDsa), GostECDsa.Create },
{ typeof(Grasshopper), Grasshopper.Create },
{ typeof(Magma), Magma.Create },
diff --git a/tests/OpenGost.Security.Cryptography.Tests/GostECDsaCertificateExtensionsFacts.cs b/tests/OpenGost.Security.Cryptography.Tests/GostECDsaCertificateExtensionsFacts.cs
index 087166c..369a6f6 100644
--- a/tests/OpenGost.Security.Cryptography.Tests/GostECDsaCertificateExtensionsFacts.cs
+++ b/tests/OpenGost.Security.Cryptography.Tests/GostECDsaCertificateExtensionsFacts.cs
@@ -53,7 +53,7 @@ public void GetGostECDsaPublicKey_ReturnsPublicKey(
private static X509Certificate2 GetCertificate(string certificateName)
{
- return new X509Certificate2(
+ return X509CertificateLoader.LoadCertificate(
ResourceUtils.GetBinaryResource(
$"OpenGost.Security.Cryptography.Tests.Resources.{certificateName}.cer"));
}
diff --git a/tests/OpenGost.Security.Cryptography.Tests/HexUtils.cs b/tests/OpenGost.Security.Cryptography.Tests/HexUtils.cs
deleted file mode 100644
index b23ac6d..0000000
--- a/tests/OpenGost.Security.Cryptography.Tests/HexUtils.cs
+++ /dev/null
@@ -1,48 +0,0 @@
-#if !NET6_0_OR_GREATER
-using System.Diagnostics.CodeAnalysis;
-
-namespace OpenGost.Security.Cryptography.Tests;
-
-[ExcludeFromCodeCoverage]
-internal static class Convert
-{
- public static byte[] FromHexString(this string s)
- {
- if (s is null)
- throw new ArgumentNullException(nameof(s));
- var hexStringLength = s.Length;
- if (hexStringLength % 2 != 0)
- throw CreateTextIncorrectFormatException(null);
-
- var retval = new byte[hexStringLength / 2];
- for (int i = 0, j = 0; i < hexStringLength; i += 2, j++)
- {
- try
- {
- retval[j] = (byte)
- ((s[i].GetHexadecimalIndex() << 4) ^
- s[i + 1].GetHexadecimalIndex());
- }
- catch (FormatException formatException)
- {
- throw CreateTextIncorrectFormatException(formatException);
- }
- }
- return retval;
- }
-
- private static byte GetHexadecimalIndex(this char character)
- {
- if (character >= '0' && character <= '9')
- return (byte)(character - '0');
- else if (character >= 'a' && character <= 'f')
- return (byte)(character - 'a' + 10);
- else if (character >= 'A' && character <= 'F')
- return (byte)(character - 'A' + 10);
- throw new FormatException($"Invalid character '{character}'.");
- }
-
- private static FormatException CreateTextIncorrectFormatException(Exception? innerException)
- => new("Input text has incorrect format.", innerException);
-}
-#endif
diff --git a/tests/OpenGost.Security.Cryptography.Tests/OpenGost.Security.Cryptography.Tests.csproj b/tests/OpenGost.Security.Cryptography.Tests/OpenGost.Security.Cryptography.Tests.csproj
index c49fdf4..1f75ebe 100644
--- a/tests/OpenGost.Security.Cryptography.Tests/OpenGost.Security.Cryptography.Tests.csproj
+++ b/tests/OpenGost.Security.Cryptography.Tests/OpenGost.Security.Cryptography.Tests.csproj
@@ -1,7 +1,7 @@
- net48;net6.0;net8.0
+ net9.0
@@ -10,7 +10,7 @@
-
+
diff --git a/tests/OpenGost.Security.Cryptography.Tests/Properties/AssemblyInfo.cs b/tests/OpenGost.Security.Cryptography.Tests/Properties/AssemblyInfo.cs
index b00a2b2..10b08c1 100644
--- a/tests/OpenGost.Security.Cryptography.Tests/Properties/AssemblyInfo.cs
+++ b/tests/OpenGost.Security.Cryptography.Tests/Properties/AssemblyInfo.cs
@@ -3,5 +3,5 @@
[assembly: ComVisible(false)]
[assembly: Guid("49680671-0348-43b3-8684-fc744c738f0c")]
[assembly: TestFramework(
- "OpenGost.XunitExtensions.XunitTestFrameworkWithAssemblyFixture",
+ "OpenGost.Security.Cryptography.Tests.XunitExtensions.XunitTestFrameworkWithAssemblyFixture",
"OpenGost.Security.Cryptography.Tests")]
diff --git a/tests/OpenGost.Security.Cryptography.Tests/XunitExtensions/XunitTestFrameworkWithAssemblyFixture.cs b/tests/OpenGost.Security.Cryptography.Tests/XunitExtensions/XunitTestFrameworkWithAssemblyFixture.cs
index f8c4e38..2aee7f6 100644
--- a/tests/OpenGost.Security.Cryptography.Tests/XunitExtensions/XunitTestFrameworkWithAssemblyFixture.cs
+++ b/tests/OpenGost.Security.Cryptography.Tests/XunitExtensions/XunitTestFrameworkWithAssemblyFixture.cs
@@ -1,9 +1,8 @@
using System.Diagnostics.CodeAnalysis;
-using OpenGost.Security.Cryptography;
using Xunit.Abstractions;
using Xunit.Sdk;
-namespace OpenGost.XunitExtensions;
+namespace OpenGost.Security.Cryptography.Tests.XunitExtensions;
[ExcludeFromCodeCoverage]
public class XunitTestFrameworkWithAssemblyFixture : XunitTestFramework