Documentation
¶
Overview ¶
Package trustdb is the trust material database: where trust material — the TRC and certificate chains — persists, an implementation that could differ. The engine that verifies and issues stays pkg/core/trust; this is the seam beneath it.
Kind: storage — bound by the assembly, which opens the implementation under the node's state directory; no run argument names a backend.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ChainQuery ¶
type ChainQuery struct {
// IA is the ISD-AS identifier that must be part of the AS certificate's
// subject.
IA addr.IA
// SubjectKeyID identifies the subject key that the AS certificate must
// authenticate.
SubjectKeyID []byte
// Validity is the validity period of the chain. A certificate c fulfills
// the validity requirement if c.not_before <= Validity.not_before and
// c.not_after >= Validity.not_after.
Validity cppki.Validity
}
ChainQuery identifies a set of chains that need to be looked up.
func (ChainQuery) MarshalJSON ¶
func (q ChainQuery) MarshalJSON() ([]byte, error)
MarshalJSON marshals the chain query for well formated log output.
type DB ¶
type DB interface {
// Chains looks up all chains that match the query.
Chains(context.Context, ChainQuery) ([][]*x509.Certificate, error)
// InsertChain inserts the given chain.
InsertChain(context.Context, []*x509.Certificate) (bool, error)
// DeleteExpiredChains evicts the chains whose AS certificate expired before
// the given time, and reports how many were evicted; TRCs are untouched, for
// the pinned base TRC anchors verification past its expiry as well.
DeleteExpiredChains(ctx context.Context, t time.Time) (int, error)
// SignedTRC looks up the TRC identified by the id.
SignedTRC(ctx context.Context, id cppki.TRCID) (cppki.SignedTRC, error)
// InsertTRC inserts the given TRC. Returns true if the TRC was not yet in
// the DB.
InsertTRC(ctx context.Context, trc cppki.SignedTRC) (bool, error)
Close() error
}
DB is the database interface for trust material.