Refactor and update test projects, remove obsolete tests, and upgrade dependencies
- Deleted obsolete test files for SchedulerAuditService and SchedulerMongoSessionFactory. - Removed unused TestDataFactory class. - Updated project files for Mongo.Tests to remove references to deleted files. - Upgraded BouncyCastle.Cryptography package to version 2.6.2 across multiple projects. - Replaced Microsoft.Extensions.Http.Polly with Microsoft.Extensions.Http.Resilience in Zastava.Webhook project. - Updated NetEscapades.Configuration.Yaml package to version 3.1.0 in Configuration library. - Upgraded Pkcs11Interop package to version 5.1.2 in Cryptography libraries. - Refactored Argon2idPasswordHasher to use BouncyCastle for hashing instead of Konscious. - Updated JsonSchema.Net package to version 7.3.2 in Microservice project. - Updated global.json to use .NET SDK version 10.0.101.
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
#if !STELLAOPS_CRYPTO_SODIUM
|
||||
using System;
|
||||
using System.Text;
|
||||
using Org.BouncyCastle.Crypto.Generators;
|
||||
using Org.BouncyCastle.Crypto.Parameters;
|
||||
|
||||
namespace StellaOps.Cryptography;
|
||||
|
||||
/// <summary>
|
||||
/// Managed Argon2id implementation powered by BouncyCastle.Cryptography.
|
||||
/// </summary>
|
||||
public sealed partial class Argon2idPasswordHasher
|
||||
{
|
||||
private static partial byte[] DeriveHashCore(string password, ReadOnlySpan<byte> salt, PasswordHashOptions options)
|
||||
{
|
||||
var passwordBytes = Encoding.UTF8.GetBytes(password);
|
||||
|
||||
var parameters = new Argon2Parameters.Builder(Argon2Parameters.Argon2id)
|
||||
.WithSalt(salt.ToArray())
|
||||
.WithParallelism(options.Parallelism)
|
||||
.WithIterations(options.Iterations)
|
||||
.WithMemoryAsKB(options.MemorySizeInKib)
|
||||
.Build();
|
||||
|
||||
var generator = new Argon2BytesGenerator();
|
||||
generator.Init(parameters);
|
||||
|
||||
var result = new byte[HashLengthBytes];
|
||||
generator.GenerateBytes(passwordBytes, result);
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
Reference in New Issue
Block a user