trustdb

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 19, 2018 License: Apache-2.0 Imports: 8 Imported by: 0

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

View Source
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

type DB struct {
	// contains filtered or unexported fields
}

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 New

func New(path string) (*DB, error)

func (*DB) Close

func (db *DB) Close() error

Close closes the database connection.

func (*DB) GetChainMaxVersion

func (db *DB) GetChainMaxVersion(ia addr.IA) (*cert.Chain, error)

func (*DB) GetChainMaxVersionCtx

func (db *DB) GetChainMaxVersionCtx(ctx context.Context, ia addr.IA) (*cert.Chain, error)

func (*DB) GetChainVersion

func (db *DB) GetChainVersion(ia addr.IA, version uint64) (*cert.Chain, error)

GetChainVersion returns the specified version of the certificate chain for ia. If version is 0, 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

func (db *DB) GetIssCertMaxVersion(ia addr.IA) (*cert.Certificate, error)

GetIssCertMaxVersion returns the max version of the issuer certificate for ia.

func (*DB) GetIssCertMaxVersionCtx

func (db *DB) GetIssCertMaxVersionCtx(ctx context.Context, ia addr.IA) (*cert.Certificate, error)

GetIssCertMaxVersionCtx is the context-aware version of GetIssCertMaxVersion.

func (*DB) GetIssCertVersion

func (db *DB) GetIssCertVersion(ia addr.IA, version uint64) (*cert.Certificate, error)

GetIssCertVersion returns the specified version of the issuer certificate for ia. If version is 0, 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

func (db *DB) GetLeafCertMaxVersion(ia addr.IA) (*cert.Certificate, error)

GetLeafCertMaxVersion returns the max version of the issuer certificate for ia.

func (*DB) GetLeafCertMaxVersionCtx

func (db *DB) GetLeafCertMaxVersionCtx(ctx context.Context, ia addr.IA) (*cert.Certificate, error)

GetLeafCertMaxVersionCtx is the context-aware version of GetLeafCertMaxVersion.

func (*DB) GetLeafCertVersion

func (db *DB) GetLeafCertVersion(ia addr.IA, version uint64) (*cert.Certificate, error)

GetLeafCertVersion returns the specified version of the issuer certificate for ia. If version is 0, 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) GetTRCMaxVersion

func (db *DB) GetTRCMaxVersion(isd addr.ISD) (*trc.TRC, error)

func (*DB) GetTRCMaxVersionCtx

func (db *DB) GetTRCMaxVersionCtx(ctx context.Context, isd addr.ISD) (*trc.TRC, error)

func (*DB) GetTRCVersion

func (db *DB) GetTRCVersion(isd addr.ISD, version uint64) (*trc.TRC, error)

GetTRCVersion returns the specified version of the TRC for isd. If version is 0, this is equivalent to GetTRCMaxVersion.

func (*DB) GetTRCVersionCtx

func (db *DB) GetTRCVersionCtx(ctx context.Context, isd addr.ISD, version uint64) (*trc.TRC, error)

GetTRCVersionCtx is the context aware version of GetTRCVersion.

func (*DB) InsertChain

func (db *DB) InsertChain(chain *cert.Chain) (int64, error)

InsertChain inserts chain into the database. The first return value is the number of rows affected.

func (*DB) InsertChainCtx

func (db *DB) InsertChainCtx(ctx context.Context, chain *cert.Chain) (int64, error)

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 *DB) InsertIssCertCtx(ctx context.Context, crt *cert.Certificate) (int64, error)

func (*DB) InsertLeafCert

func (db *DB) InsertLeafCert(c *cert.Certificate) (int64, error)

InsertLeafCert inserts the issuer certificate.

func (*DB) InsertLeafCertCtx

func (db *DB) InsertLeafCertCtx(ctx context.Context, crt *cert.Certificate) (int64, error)

func (*DB) InsertTRC

func (db *DB) InsertTRC(trcobj *trc.TRC) (int64, error)

InsertTRC inserts trcobj into the database. The first return value is the number of rows affected.

func (*DB) InsertTRCCtx

func (db *DB) InsertTRCCtx(ctx context.Context, trcobj *trc.TRC) (int64, error)

InsertTRCCtx is the context aware version of InsertTRC.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL