namespace StellaOps.Cryptography;
///
/// Well-known HMAC algorithm identifiers used by compliance profiles.
///
public static class HmacAlgorithms
{
///
/// HMAC using SHA-256 (FIPS 198-1, RFC 2104).
/// Used by: world, fips, kcmvp, eidas profiles.
///
public const string HmacSha256 = "HMAC-SHA256";
///
/// HMAC using SHA-384 (FIPS 198-1, RFC 2104).
///
public const string HmacSha384 = "HMAC-SHA384";
///
/// HMAC using SHA-512 (FIPS 198-1, RFC 2104).
///
public const string HmacSha512 = "HMAC-SHA512";
///
/// HMAC using GOST R 34.11-2012 Stribog 256-bit (RFC 6986).
/// Used by: gost profile.
///
public const string HmacGost3411 = "HMAC-GOST3411";
///
/// HMAC using SM3 (GB/T 32905-2016).
/// Used by: sm profile.
///
public const string HmacSm3 = "HMAC-SM3";
///
/// All known HMAC algorithms for validation.
///
public static readonly IReadOnlyList All = new[]
{
HmacSha256,
HmacSha384,
HmacSha512,
HmacGost3411,
HmacSm3
};
///
/// Validates whether the given algorithm is a known HMAC algorithm.
///
/// The algorithm identifier to validate.
/// True if the algorithm is known; otherwise, false.
public static bool IsKnown(string? algorithmId)
=> !string.IsNullOrWhiteSpace(algorithmId) && All.Contains(algorithmId);
}