Documentation
¶
Overview ¶
Package attest provides capture-time, off-host-verifiable signing for evidence - the difference between an audit log and an audit log a defender can trust after host compromise.
AgentProvenance's `graph verify` recomputes hashes from a SQLite file the attacker controls post-root: rewrite the row, recompute the chain, verify passes. That is integrity against corruption, not tamper-evidence against the HIDS threat model. This package signs an evidence digest with a key at capture time so that, even if the store is later rewritten, the signature over the original digest no longer verifies.
The formats are deliberately standard rather than bespoke:
- the payload is an in-toto Statement (subject digests + a predicate),
- the envelope is DSSE (Dead Simple Signing Envelope, the in-toto/SLSA transport), with ed25519 signatures.
The signing key here is a local ed25519 key (file/env). Anchoring it in a TPM or remote KMS so it is unobtainable after root, and posting the chain head to an external transparency log, are deployment concerns layered on top of this primitive; the wire format does not change.
Index ¶
- Constants
- func DigestSHA256(data []byte) string
- func GenerateKey() (ed25519.PublicKey, ed25519.PrivateKey, string, error)
- func KeyID(pub ed25519.PublicKey) string
- func LoadPrivateKeyHex(path string) (ed25519.PrivateKey, error)
- func LoadPublicKeyHex(path string) (ed25519.PublicKey, error)
- type Envelope
- type Signature
- type Statement
- type Subject
Constants ¶
const ( StatementType = "https://in-toto.io/Statement/v1" DefaultPredicateType = "https://agentprovenance.dev/Evidence/v1" )
StatementType and PredicateType identify the in-toto payload.
Variables ¶
This section is empty.
Functions ¶
func DigestSHA256 ¶
DigestSHA256 returns the hex sha256 of data, the canonical subject digest.
func GenerateKey ¶
GenerateKey returns a fresh ed25519 keypair and its key id (a short hash of the public key), for tests and bootstrap.
func KeyID ¶
KeyID is a stable short identifier for a public key (first 16 hex of its sha256), used to tag signatures so a verifier can select the right key.
func LoadPrivateKeyHex ¶
func LoadPrivateKeyHex(path string) (ed25519.PrivateKey, error)
LoadPrivateKeyHex loads a hex-encoded ed25519 private key (seed or full key) from path. A 32-byte value is treated as a seed; a 64-byte value as the full private key. This keeps the on-disk format trivial; a TPM/KMS-backed signer would implement the same Sign call without changing the wire format.
Types ¶
type Envelope ¶
type Envelope struct {
PayloadType string `json:"payloadType"`
Payload string `json:"payload"` // base64(canonical statement JSON)
Signatures []Signature `json:"signatures"`
}
Envelope is a DSSE envelope carrying a base64 payload and ed25519 signatures.
type Statement ¶
type Statement struct {
Type string `json:"_type"`
Subject []Subject `json:"subject"`
PredicateType string `json:"predicateType"`
Predicate any `json:"predicate,omitempty"`
}
Statement is an in-toto v1 statement: what is being attested (subjects) and the claim about it (predicate).
func NewStatement ¶
NewStatement builds an in-toto statement over a single subject digest.