up
Some checks failed
Docs CI / lint-and-preview (push) Has been cancelled
AOC Guard CI / aoc-guard (push) Has been cancelled
AOC Guard CI / aoc-verify (push) Has been cancelled
api-governance / spectral-lint (push) Has been cancelled
oas-ci / oas-validate (push) Has been cancelled
Policy Lint & Smoke / policy-lint (push) Has been cancelled
Policy Simulation / policy-simulate (push) Has been cancelled
SDK Publish & Sign / sdk-publish (push) Has been cancelled
Some checks failed
Docs CI / lint-and-preview (push) Has been cancelled
AOC Guard CI / aoc-guard (push) Has been cancelled
AOC Guard CI / aoc-verify (push) Has been cancelled
api-governance / spectral-lint (push) Has been cancelled
oas-ci / oas-validate (push) Has been cancelled
Policy Lint & Smoke / policy-lint (push) Has been cancelled
Policy Simulation / policy-simulate (push) Has been cancelled
SDK Publish & Sign / sdk-publish (push) Has been cancelled
This commit is contained in:
@@ -11,7 +11,8 @@ public enum CryptoCapability
|
||||
Signing,
|
||||
Verification,
|
||||
SymmetricEncryption,
|
||||
KeyDerivation
|
||||
KeyDerivation,
|
||||
ContentHashing
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -30,6 +31,13 @@ public interface ICryptoProvider
|
||||
|
||||
IPasswordHasher GetPasswordHasher(string algorithmId);
|
||||
|
||||
/// <summary>
|
||||
/// Retrieves a content hasher for the supplied algorithm.
|
||||
/// </summary>
|
||||
/// <param name="algorithmId">Hash algorithm identifier (e.g., SHA-256, GOST-R-34.11-2012-256).</param>
|
||||
/// <returns>Hasher instance.</returns>
|
||||
ICryptoHasher GetHasher(string algorithmId);
|
||||
|
||||
/// <summary>
|
||||
/// Retrieves a signer for the supplied algorithm and key reference.
|
||||
/// </summary>
|
||||
@@ -81,6 +89,37 @@ public interface ICryptoProviderRegistry
|
||||
string algorithmId,
|
||||
CryptoKeyReference keyReference,
|
||||
string? preferredProvider = null);
|
||||
|
||||
/// <summary>
|
||||
/// Resolves a content hasher for the supplied algorithm using registry policy.
|
||||
/// </summary>
|
||||
/// <param name="algorithmId">Hash algorithm identifier (e.g., SHA-256, GOST-R-34.11-2012-256).</param>
|
||||
/// <param name="preferredProvider">Optional provider hint.</param>
|
||||
/// <returns>Resolved hasher with provider name.</returns>
|
||||
CryptoHasherResolution ResolveHasher(string algorithmId, string? preferredProvider = null);
|
||||
}
|
||||
|
||||
public sealed record CryptoSignerResolution(ICryptoSigner Signer, string ProviderName);
|
||||
|
||||
public sealed record CryptoHasherResolution(ICryptoHasher Hasher, string ProviderName);
|
||||
|
||||
/// <summary>
|
||||
/// Content hasher for computing cryptographic digests.
|
||||
/// </summary>
|
||||
public interface ICryptoHasher
|
||||
{
|
||||
/// <summary>
|
||||
/// Algorithm identifier (e.g., SHA-256, GOST-R-34.11-2012-256).
|
||||
/// </summary>
|
||||
string AlgorithmId { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Computes the hash of the given data.
|
||||
/// </summary>
|
||||
byte[] ComputeHash(ReadOnlySpan<byte> data);
|
||||
|
||||
/// <summary>
|
||||
/// Computes the hash and returns it as a lowercase hex string.
|
||||
/// </summary>
|
||||
string ComputeHashHex(ReadOnlySpan<byte> data);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user