Class PolicySignature
- Namespace
- JD.AI.Core.Governance
- Assembly
- JD.AI.Core.dll
Signs and verifies policy documents using HMAC-SHA256.
Signatures are stored as a # jdai-signature: {hex} comment line
at the end of the YAML file.
public static class PolicySignature
- Inheritance
-
PolicySignature
- Inherited Members
Methods
ExtractSignature(string)
Extracts the hex signature from a signed YAML file, or null if unsigned.
public static string? ExtractSignature(string yaml)
Parameters
yamlstring
Returns
Sign(string, byte[])
Signs a YAML policy file by appending an HMAC-SHA256 signature line.
public static string Sign(string yaml, byte[] key)
Parameters
Returns
StripSignature(string)
Strips the signature line from a YAML file, returning only the content.
public static string StripSignature(string yaml)
Parameters
yamlstring
Returns
Verify(string, byte[])
Verifies the HMAC-SHA256 signature embedded in a YAML policy file.
Returns true if the signature is valid, false if missing or invalid.
public static bool Verify(string yaml, byte[] key)