Initial commit (history squashed)
Some checks failed
Build Test Deploy / authority-container (push) Has been cancelled
Build Test Deploy / docs (push) Has been cancelled
Build Test Deploy / deploy (push) Has been cancelled
Build Test Deploy / build-test (push) Has been cancelled
Docs CI / lint-and-preview (push) Has been cancelled
Some checks failed
Build Test Deploy / authority-container (push) Has been cancelled
Build Test Deploy / docs (push) Has been cancelled
Build Test Deploy / deploy (push) Has been cancelled
Build Test Deploy / build-test (push) Has been cancelled
Docs CI / lint-and-preview (push) Has been cancelled
This commit is contained in:
44
src/StellaOps.Cryptography/CryptoProvider.cs
Normal file
44
src/StellaOps.Cryptography/CryptoProvider.cs
Normal file
@@ -0,0 +1,44 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace StellaOps.Cryptography;
|
||||
|
||||
/// <summary>
|
||||
/// High-level cryptographic capabilities supported by StellaOps providers.
|
||||
/// </summary>
|
||||
public enum CryptoCapability
|
||||
{
|
||||
PasswordHashing,
|
||||
Signing,
|
||||
Verification,
|
||||
SymmetricEncryption,
|
||||
KeyDerivation
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Identifies a stored key or certificate handle.
|
||||
/// </summary>
|
||||
public sealed record CryptoKeyReference(string KeyId, string? ProviderHint = null);
|
||||
|
||||
/// <summary>
|
||||
/// Contract implemented by crypto providers (BCL, CryptoPro, OpenSSL, etc.).
|
||||
/// </summary>
|
||||
public interface ICryptoProvider
|
||||
{
|
||||
string Name { get; }
|
||||
|
||||
bool Supports(CryptoCapability capability, string algorithmId);
|
||||
|
||||
IPasswordHasher GetPasswordHasher(string algorithmId);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Registry managing provider discovery and policy selection.
|
||||
/// </summary>
|
||||
public interface ICryptoProviderRegistry
|
||||
{
|
||||
IReadOnlyCollection<ICryptoProvider> Providers { get; }
|
||||
|
||||
bool TryResolve(string preferredProvider, out ICryptoProvider provider);
|
||||
|
||||
ICryptoProvider ResolveOrThrow(CryptoCapability capability, string algorithmId);
|
||||
}
|
||||
Reference in New Issue
Block a user