Skip to content

SAIF.NetCore.SystemHash overview

Documentation context: NuGet package (pipeline-packed), consumed as SAIF.NetCore.SystemHash by application startup code and by SAIF.NetCore.EnvironmentClient and SAIF.NetCore.OIDC through the ISystemHashService interface only.

SAIF.NetCore.SystemHash is a single-class implementation-layer library that produces and validates a system-hash caller-identity credential: a SHA-256/Base64 digest of an application's assembly name and a SystemType classification, salted with a timestamp by SAIF.NetCore.HashUtil's SaltShaker. Consumers present the salted credential to the external Environment API to retrieve secure settings or crypto configuration; this library also implements the server-side lifetime check that rejects an expired credential. It targets net8.0 and net10.0.

Purpose

  • Issue a time-stamped, salted identity credential (ComputeHash, Get) that a calling application attaches to secure-setting requests.
  • Compute the deterministic, unsalted identity hash (ComputeHashNow) that a validating service can compare a de-salted credential against.
  • De-salt a previously issued credential and enforce its lifetime window (RemoveSystemHashSaltAndValidateLifetime), throwing SystemHashExpiredException (from SAIF.NetCore.HashUtil) when the credential is expired or not yet valid.

Responsibilities

  • Implement ISystemHashService (SAIF.NetCore.ServiceContracts) as the repository's sole concrete SystemHashService.
  • Resolve the "system name" used in the identity hash from either an explicitly supplied Assembly (constructor) or Assembly.GetCallingAssembly().
  • Delegate the reversible salt/de-salt mechanics to SAIF.NetCore.HashUtil's SaltShaker, while owning the create-timestamp selection and the lifetime decision itself.

Key components

  • SystemHashService: the library's only public type; implements all five ISystemHashService members and the private GetHashValue SHA-256 helper.

Sources

  • src/SAIF.NetCore.SystemHash/SAIF.NetCore.SystemHash/SAIF.NetCore.SystemHash/SAIF.NetCore.SystemHash.csproj
  • src/SAIF.NetCore.SystemHash/SAIF.NetCore.SystemHash/SAIF.NetCore.SystemHash/SystemHashService.cs
  • src/SAIF.NetCore.SystemHash/README.md