Documentation ¶
Overview ¶
Package trustdb provides wrappers for SQL calls for managing a database containing TRCs and Certificate Chains.
KNOWN ISSUE: DB methods serialize to/dezerialize from JSON on each call. For performance penalty details, check the benchmarks in the test file.
Index ¶
- Constants
- type DB
- func (db *DB) Close() error
- func (db *DB) GetChainMaxVersion(ia addr.IA) (*cert.Chain, error)
- func (db *DB) GetChainMaxVersionCtx(ctx context.Context, ia addr.IA) (*cert.Chain, error)
- func (db *DB) GetChainVersion(ia addr.IA, version uint64) (*cert.Chain, error)
- func (db *DB) GetChainVersionCtx(ctx context.Context, ia addr.IA, version uint64) (*cert.Chain, error)
- func (db *DB) GetIssCertMaxVersion(ia addr.IA) (*cert.Certificate, error)
- func (db *DB) GetIssCertMaxVersionCtx(ctx context.Context, ia addr.IA) (*cert.Certificate, error)
- func (db *DB) GetIssCertVersion(ia addr.IA, version uint64) (*cert.Certificate, error)
- func (db *DB) GetIssCertVersionCtx(ctx context.Context, ia addr.IA, version uint64) (*cert.Certificate, error)
- func (db *DB) GetLeafCertMaxVersion(ia addr.IA) (*cert.Certificate, error)
- func (db *DB) GetLeafCertMaxVersionCtx(ctx context.Context, ia addr.IA) (*cert.Certificate, error)
- func (db *DB) GetLeafCertVersion(ia addr.IA, version uint64) (*cert.Certificate, error)
- func (db *DB) GetLeafCertVersionCtx(ctx context.Context, ia addr.IA, version uint64) (*cert.Certificate, error)
- func (db *DB) GetTRCMaxVersion(isd addr.ISD) (*trc.TRC, error)
- func (db *DB) GetTRCMaxVersionCtx(ctx context.Context, isd addr.ISD) (*trc.TRC, error)
- func (db *DB) GetTRCVersion(isd addr.ISD, version uint64) (*trc.TRC, error)
- func (db *DB) GetTRCVersionCtx(ctx context.Context, isd addr.ISD, version uint64) (*trc.TRC, error)
- func (db *DB) InsertChain(chain *cert.Chain) (int64, error)
- func (db *DB) InsertChainCtx(ctx context.Context, chain *cert.Chain) (int64, error)
- func (db *DB) InsertIssCert(c *cert.Certificate) (int64, error)
- func (db *DB) InsertIssCertCtx(ctx context.Context, crt *cert.Certificate) (int64, error)
- func (db *DB) InsertLeafCert(c *cert.Certificate) (int64, error)
- func (db *DB) InsertLeafCertCtx(ctx context.Context, crt *cert.Certificate) (int64, error)
- func (db *DB) InsertTRC(trcobj *trc.TRC) (int64, error)
- func (db *DB) InsertTRCCtx(ctx context.Context, trcobj *trc.TRC) (int64, error)
Constants ¶
const ( Path = "trustDB.sqlite3" SchemaVersion = 1 Schema = `` /* 811-byte string literal not displayed */ TRCsTable = "TRCs" ChainsTable = "Chains" IssuerCertsTable = "IssuerCerts" LeafCertsTable = "LeafCerts" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DB ¶
DB is a database containing Certificates, Chains and TRCs, stored in JSON format.
On errors, GetXxx methods return nil and the error. If no error occurred, but the database query yielded 0 results, the first returned value is nil. GetXxxCtx methods are the context equivalents of GetXxx.
func (*DB) GetChainMaxVersionCtx ¶
func (*DB) GetChainVersion ¶
GetChainVersion returns the specified version of the certificate chain for ia. If version is scrypto.LatestVer, this is equivalent to GetChainMaxVersion.
func (*DB) GetChainVersionCtx ¶
func (db *DB) GetChainVersionCtx(ctx context.Context, ia addr.IA, version uint64) (*cert.Chain, error)
GetChainVersionCtx is the context-aware version of GetChainVersion.
func (*DB) GetIssCertMaxVersion ¶
GetIssCertMaxVersion returns the max version of the issuer certificate for ia.
func (*DB) GetIssCertMaxVersionCtx ¶
GetIssCertMaxVersionCtx is the context-aware version of GetIssCertMaxVersion.
func (*DB) GetIssCertVersion ¶
GetIssCertVersion returns the specified version of the issuer certificate for ia. If version is scrypto.LatestVer, this is equivalent to GetCertMaxVersion.
func (*DB) GetIssCertVersionCtx ¶
func (db *DB) GetIssCertVersionCtx(ctx context.Context, ia addr.IA, version uint64) (*cert.Certificate, error)
GetIssCertVersionCtx is the context-aware version of GetIssCertVersion.
func (*DB) GetLeafCertMaxVersion ¶
GetLeafCertMaxVersion returns the max version of the issuer certificate for ia.
func (*DB) GetLeafCertMaxVersionCtx ¶
GetLeafCertMaxVersionCtx is the context-aware version of GetLeafCertMaxVersion.
func (*DB) GetLeafCertVersion ¶
GetLeafCertVersion returns the specified version of the issuer certificate for ia. If version is scrypto.LatestVer, this is equivalent to GetCertMaxVersion.
func (*DB) GetLeafCertVersionCtx ¶
func (db *DB) GetLeafCertVersionCtx(ctx context.Context, ia addr.IA, version uint64) (*cert.Certificate, error)
GetLeafCertVersionCtx is the context-aware version of GetLeafCertVersion.
func (*DB) GetTRCMaxVersionCtx ¶
func (*DB) GetTRCVersion ¶
GetTRCVersion returns the specified version of the TRC for isd. If version is scrypto.LatestVer, this is equivalent to GetTRCMaxVersion.
func (*DB) GetTRCVersionCtx ¶
GetTRCVersionCtx is the context aware version of GetTRCVersion.
func (*DB) InsertChain ¶
InsertChain inserts chain into the database. The first return value is the number of rows affected.
func (*DB) InsertChainCtx ¶
InsertChainCtx is the context aware version of InsertChain.
func (*DB) InsertIssCert ¶
func (db *DB) InsertIssCert(c *cert.Certificate) (int64, error)
InsertIssCert inserts the issuer certificate.
func (*DB) InsertIssCertCtx ¶
func (*DB) InsertLeafCert ¶
func (db *DB) InsertLeafCert(c *cert.Certificate) (int64, error)
InsertLeafCert inserts the issuer certificate.